Re: [hackers] [sbase] [PATCH 02/10] od: Fix buffer overflow if -N flag is larger than BUFSIZ

From: Silvan Jegen <s.jegen_AT_gmail.com>
Date: Tue, 6 Dec 2016 10:10:27 +0100

On Tue, Dec 6, 2016 at 9:08 AM, Michael Forney <mforney_AT_mforney.org> wrote:
> On Mon, Dec 5, 2016 at 4:47 AM, Silvan Jegen <s.jegen_AT_gmail.com> wrote:
>> From what I understand, max is an off_t which is signed and set to -1
>> (if not changed by a command line flag). If we cast this to the
>> unsigned size_t we get a very big number in the case where 'max' is
>> not set by a flag and the buffer size is used instead. Looks correct
>> to me.
>
> I will switch it back to check if max >= 0, because I think there
> could be a problem if off_t was larger than size_t.

As far as I can tell, both of these *may* be defined as 64-bit
integers. I would assume that there exists no programming environment
where only one of them is defined as a 64-bit integer and the other
one isn't so the bit-size should always be the same.

Checking for "max >= 0" may be clearer in any case though.
Received on Tue Dec 06 2016 - 10:10:27 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 06 2016 - 10:12:17 CET