On 2024/08/29 06:44:00 +0200, Anton Lindqvist <an...@basename.se> wrote:
> On Wed, Aug 28, 2024 at 05:40:33AM -0600, Omar Polo wrote:
> > CVSROOT:    /cvs
> > Module name:        src
> > Changes by: o...@cvs.openbsd.org    2024/08/28 05:40:33
> > 
> > Modified files:
> >     lib/libpcap    : scanner.l 
> > 
> > Log message:
> > libpcap: replace hand-rolled number parser with strtol
> > 
> > can't use strtonum here since it needs to handle octal and hex
> > notations as well.  Part of a larger diff that's ok beck@
> 
> This broke slaacd, vxlan, wg and rip6cksum regress. I doubt it was ever
> tested.
> 
> According to the manual, strtol() assigns endptr to '\0' when the
> complete string is valid.

ok op@, sorry for the breakage.  this was a later change that i have not
tested, i felt confident enough.  sigh.

> Index: scanner.l
> ===================================================================
> RCS file: /cvs/src/lib/libpcap/scanner.l,v
> diff -u -p -r1.31 scanner.l
> --- scanner.l 28 Aug 2024 11:40:33 -0000      1.31
> +++ scanner.l 29 Aug 2024 04:43:02 -0000
> @@ -344,7 +344,7 @@ stoi(char *s)
>  
>       errno = 0;
>       lval = strtol(s, &ep, 0);
> -     if (*s == '\0' || *ep == '\0')
> +     if (*s == '\0' || *ep != '\0')
>               bpf_error("invalid number %s", s);
>       if ((errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN)) ||
>           (lval > INT_MAX || lval < INT_MIN))


Reply via email to