Page MenuHomeFreeBSD

rtld: check for overflow in parse_integer()
ClosedPublic

Authored by kib on Mar 29 2026, 11:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 27, 2:01 PM
Unknown Object (File)
Mon, Apr 27, 8:29 AM
Unknown Object (File)
Sat, Apr 25, 5:24 AM
Unknown Object (File)
Fri, Apr 24, 5:04 PM
Unknown Object (File)
Mon, Apr 20, 4:10 PM
Unknown Object (File)
Mon, Apr 20, 4:10 PM
Unknown Object (File)
Fri, Apr 17, 12:15 PM
Unknown Object (File)
Thu, Apr 16, 10:54 PM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Mar 29 2026, 11:09 PM
libexec/rtld-elf/rtld.c
6507

Can we use the stdckint.h routines instead? There is no libc dependency there.

libexec/rtld-elf/rtld.c
6507

Can we use the stdckint.h routines instead? There is no libc dependency there.

You can also avoid the need for wrapping, and avoid unsigned ints, like so:

if (n > INT_MAX / 10)
  return (-1);
n *= 10;
if (n > INT_MAX - (c - '\0'))
  return (-1);
n += (c - '\0');

No need for stdckint.h then, either.

kib marked 2 inline comments as done.

Take Dimitry suggestion.

This revision is now accepted and ready to land.Mar 30 2026, 12:21 PM
This revision was automatically updated to reflect the committed changes.