From 6131aee8c143b7dddbc3d115a3d065867d7817d1 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Mon, 8 Aug 2005 19:36:45 +0000 Subject: [PATCH] * 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. --- ChangeLog | 10 ++++++++++ amd/sun_map_parse.y | 5 +++-- amd/sun_map_tok.l | 3 +++ libamu/xutil.c | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f83dea..ff7d06a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-08-08 Erez Zadok + + * 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 * libamu/util.c, amd/autil.c (strsplit): moved strsplit() function diff --git a/amd/sun_map_parse.y b/amd/sun_map_parse.y index 21dcf5b..433b8a1 100644 --- a/amd/sun_map_parse.y +++ b/amd/sun_map_parse.y @@ -51,9 +51,10 @@ #include #include -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 char* tmpFsType = NULL; +static char *tmpFsType = NULL; /* diff --git a/amd/sun_map_tok.l b/amd/sun_map_tok.l index 9a29c82..f078485 100644 --- a/amd/sun_map_tok.l +++ b/amd/sun_map_tok.l @@ -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} { diff --git a/libamu/xutil.c b/libamu/xutil.c index 7d6966e..b9ce246 100644 --- a/libamu/xutil.c +++ b/libamu/xutil.c @@ -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\")", -- 2.43.0