Date:        Wed, 28 Nov 2018 00:23:47 +0100
    From:        =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= <mgo...@gentoo.org>
    Message-ID:  <1543361027.17222.11.ca...@gentoo.org>

I have no idea whether this is something that we want or not,
but assuming that we do ...

  | so I'd appreciate some pointers if I'm doing things right.

I think you need to watch for sign extension from *str (str is a char *, not 
u_char *) which probably means &0xFF is needed, and I'd suggest
that rather than doing <<8 >> 8 and comparing for equality, testing
whether you're going to overflow when doing a <<8 is better done as
        if (tval > (UINTMAX_MAX/256))

I also see that the other conversions work if len == 0 (they return 0),
which your one doesn't, it might be worth a "len > 0" in the initial test
(so you never look at *str if len == 0).

kre

Reply via email to