Subject: Re: bin/23362: usermod doesn't check for overflow of uid/gid
To: David Laight <david@l8s.co.uk>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-bugs
Date: 11/03/2003 21:22:52
David Laight <david@l8s.co.uk> wrote:
> The ISO C standard requires that a C compiler must issue a
> diagnostic for constants that are too large to represent.
I'm not sure whether the code of atoi() resp. strtol() ever creates
a too large value. AFAIK, this actually the error indication of
strtol i.e., LONG_MAX. So there doesn't happen an overflow on the
C layer.
> Most standard utilities are not required to issue these diagnostics;
> for example, the command:
>
> diff -C 2147483648 file1 file2
>
> has undefined behavior, and the diff utility is not required to
> issue a diagnostic even if the number 2147483648 cannot be
> represented.
Actually, neither diff nor usermod are C compilers, so such argument
cannot be applied, IMHO. As a user I don't have to know whether a
program was coded in C, Java, Python, Perl or whatever. But I can
expect that the program behaves as documented. If there are any
arbitrary limits for input values, they should be documented. I really
don't understand the diff example. How am I supposed to know what
kind of variables are used inside the code? Does that depended on the
platform? Of course, I know that every computer has limited memory
resources and humans have limited time resources.
OK, usermod isn't specified by any standard, so it could as well
format all my partitions and eat my pets. Is that what you're trying
to tell me?
--
Christian