* amd/sun_map_tok.l: allocate more output slots so lex scanners
authorErez Zadok <ezk@cs.sunysb.edu>
Mon, 8 Aug 2005 19:36:45 +0000 (19:36 +0000)
committerErez Zadok <ezk@cs.sunysb.edu>
Mon, 8 Aug 2005 19:36:45 +0000 (19:36 +0000)
don't run out of memory.

* amd/sun_map_parse.y: declare extern for sun_map_parse().

* libamu/xutil.c (xsnprintf): ensure proper comparisons between
signed and unsigned quantities.

ChangeLog
amd/sun_map_parse.y
amd/sun_map_tok.l
libamu/xutil.c

index 4f83dea0039cdb1a4ca348a13bfc663aaa450bc2..ff7d06afeae54ff7bcfc31d0f51369586f2feb91 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-08-08  Erez Zadok  <ezk@cs.sunysb.edu>
+
+       * amd/sun_map_tok.l: allocate more output slots so lex scanners
+       don't run out of memory.
+
+       * amd/sun_map_parse.y: declare extern for sun_map_parse().
+
+       * libamu/xutil.c (xsnprintf): ensure proper comparisons between
+       signed and unsigned quantities.
+
 2005-08-06  Erez Zadok  <ezk@cs.sunysb.edu>
 
        * libamu/util.c, amd/autil.c (strsplit): moved strsplit() function
index 21dcf5b76dbc2cd6f0aaf038d33d8a2173dce978..433b8a1d964b698ebcb0dc5e7794322ecee3c863 100644 (file)
 #include <amd.h>
 #include <sun_map.h>
 
-extern int sun_map_lex();
+extern int sun_map_lex(void);
 extern int sun_map_error(const char* s);
 extern void sun_map_tok_setbuff(const char *);
+extern int sun_map_parse(void);
 
 struct sun_entry *sun_map_parse_read(const char *map_data);
 
@@ -63,7 +64,7 @@ static struct sun_list *sun_opt_list = NULL;
 static struct sun_list *sun_host_list = NULL;
 static struct sun_list *sun_location_list = NULL;
 static struct sun_list *mountpt_list = NULL;
-static chartmpFsType = NULL;
+static char *tmpFsType = NULL;
 
 
 /*
index 9a29c826545b569adbe8297ac3a230958b9aa61b..f078485a4b3a3ede4cf8f752a6a6732603ae9af2 100644 (file)
@@ -97,6 +97,9 @@ CONTINUE_REX   "\\"\n
  */
 %option nounput
 
+/* allocate more output slots so lex scanners don't run out of mem */
+%o 1024
+
 %%
 
 {WORD_REX}      {
index 7d6966e2f6e628391738f60af8843f6e0813c76b..b9ce2469cb35ab3531a42ae13135e7ab1c5953bc 100644 (file)
@@ -974,7 +974,7 @@ xsnprintf(char *str, size_t size, const char *format, ...)
    * possible infinite recursion between plog() and xsnprintf().  If it ever
    * happens, it'd indicate a bug in Amd.
    */
-  if (ret < 0 || ret >= size) {        /* error or truncation occured */
+  if (ret < 0 || (size_t) ret >= size) { /* error or truncation occured */
     static int maxtrunc;       /* hack to avoid inifinite loop */
     if (++maxtrunc > 10)
       plog(XLOG_ERROR, "BUG: string %p truncated (ret=%d, format=\"%s\")",