From 606f52e77d930f982bf9dd2c205228023330a93a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 12 Aug 2013 17:51:57 +0200 Subject: config: check (and fix) some integer limits --- src/config.l | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/config.l') diff --git a/src/config.l b/src/config.l index 295352f..c9f25d8 100644 --- a/src/config.l +++ b/src/config.l @@ -55,7 +55,21 @@ %} { -[0-9]+ { UPDATE_LOCATION; yylval->num = atoi(yytext); BEGIN(NEEDSPACE); return TOK_INTEGER; } +[0-9]+ { + char *endptr; + + UPDATE_LOCATION; + + yylval->uint64 = strtoull(yytext, &endptr, 10); + if (*endptr) { + yylval->error = "invalid integer constant"; + return -1; + } + + + BEGIN(NEEDSPACE); + return TOK_UINT; +} interface { TOKEN(TOK_INTERFACE); } bind { TOKEN(TOK_BIND); } -- cgit v1.2.3