[Bro-Dev] [Bro-Commits] [git/bro] fastpath: parse 64-bit consts correctly. (03f5795)
Robin Sommer
robin at icir.org
Tue Aug 28 13:30:44 PDT 2012
I lost track; is this all we need, or are there more cases to fix?
Robin
On Tue, Aug 28, 2012 at 07:33 -0700, Bernhard Amann wrote:
> parse 64-bit consts correctly.
> --- a/src/scan.l
> +++ b/src/scan.l
> @@ -439,7 +439,7 @@ F RET_CONST(new Val(false, TYPE_BOOL))
> {D} {
> // TODO: check if we can use strtoull instead of atol,
> // and similarly for {HEX}.
> - RET_CONST(new Val(static_cast<unsigned int>(atol(yytext)),
> + RET_CONST(new Val(static_cast<bro_uint_t>(strtoll(yytext, (char**) NULL, 10)),
> TYPE_COUNT))
> }
> {FLOAT} RET_CONST(new Val(atof(yytext), TYPE_DOUBLE))
> @@ -483,7 +483,7 @@ F RET_CONST(new Val(false, TYPE_BOOL))
>
> ({D}"."){3}{D} RET_CONST(new AddrVal(yytext))
>
> -"0x"{HEX}+ RET_CONST(new Val(static_cast<bro_uint_t>(strtol(yytext, 0, 16)), TYPE_COUNT))
> +"0x"{HEX}+ RET_CONST(new Val(static_cast<bro_uint_t>(strtoull(yytext, 0, 16)), TYPE_COUNT))
>
> {H}("."{H})+ RET_CONST(dns_mgr->LookupHost(yytext))
--
Robin Sommer * Phone +1 (510) 722-6541 * robin at icir.org
ICSI/LBNL * Fax +1 (510) 666-2956 * www.icir.org
More information about the bro-dev
mailing list