From: Marcin Haba Date: Thu, 27 Mar 2014 17:33:11 +0000 (+0100) Subject: Fix for too small length of config token X-Git-Tag: Release-7.0.0~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6c66e19c9ef2a961e2e855ab0c0a5b3489f19b46;p=bacula%2Fbacula Fix for too small length of config token --- diff --git a/bacula/src/lib/lex.c b/bacula/src/lib/lex.c index d8e7dd7137..1fdde032b1 100644 --- a/bacula/src/lib/lex.c +++ b/bacula/src/lib/lex.c @@ -127,6 +127,8 @@ LEX *lex_close_file(LEX *lf) free(lf->fname); free_memory(lf->line); lf->line = NULL; + free_memory(lf->str); + lf->str = NULL; if (of) { of->options = lf->options; /* preserve options */ memcpy(lf, of, sizeof(LEX)); @@ -196,6 +198,7 @@ LEX *lex_open_file(LEX *lf, const char *filename, LEX_ERROR_HANDLER *scan_error) lf->line = get_memory(5000); lf->state = lex_none; lf->ch = L_EOL; + lf->str = get_memory(5000); Dmsg1(dbglvl, "Return lex=%x\n", lf); return lf; } @@ -249,7 +252,7 @@ void lex_unget_char(LEX *lf) */ static void add_str(LEX *lf, int ch) { - if (lf->str_len >= MAXSTRING-3) { + if (lf->str_len >= sizeof_pool_memory(lf->str)) { Emsg3(M_ERROR_TERM, 0, _( _("Config token too long, file: %s, line %d, begins at line %d\n")), lf->fname, lf->line_no, lf->begin_line_no); diff --git a/bacula/src/lib/lex.h b/bacula/src/lib/lex.h index 08db120b30..d2568fc669 100644 --- a/bacula/src/lib/lex.h +++ b/bacula/src/lib/lex.h @@ -93,7 +93,7 @@ typedef struct s_lex_context { char *fname; /* filename */ FILE *fd; /* file descriptor */ POOLMEM *line; /* input line */ - char str[MAXSTRING]; /* string being scanned */ + POOLMEM *str; /* string being scanned */ int str_len; /* length of string */ int line_no; /* file line number */ int col_no; /* char position on line */