diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-08-12 17:51:57 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-08-12 17:51:57 +0200 |
commit | 606f52e77d930f982bf9dd2c205228023330a93a (patch) | |
tree | c8e90b48f3094c6791afe82f123abfa67647094d /src/config.l | |
parent | 8622d8625c12d3cc7ac248df8be5612519a59565 (diff) | |
download | fastd-606f52e77d930f982bf9dd2c205228023330a93a.tar fastd-606f52e77d930f982bf9dd2c205228023330a93a.zip |
config: check (and fix) some integer limits
Diffstat (limited to 'src/config.l')
-rw-r--r-- | src/config.l | 16 |
1 files changed, 15 insertions, 1 deletions
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 @@ %} <INITIAL>{ -[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); } |