1 2009-01-12 Arthur Loiret <aloiret@debian.org>
3 nss/nss_files/files-parse.c: Include <limits.h>.
4 (INT_FIELD): Convert field to uintmax_t and check for 32-bit overflow.
5 (INT_FIELD_MAYBE_NULL): Likewise.
8 nss/nss_files/files-parse.c | 15 +++++++++++++--
9 1 file changed, 13 insertions(+), 2 deletions(-)
11 --- a/nss/nss_files/files-parse.c
12 +++ b/nss/nss_files/files-parse.c
18 #include <nss_files.h>
20 /* These symbols are defined by the including source file:
22 # define INT_FIELD(variable, terminator_p, swallow, base, convert) \
25 - variable = convert (strtou32 (line, &endp, base)); \
26 + unsigned long long tmp; \
27 + /* Prevent from 32-bit overflow. */ \
28 + tmp = __strtoull_internal (line, &endp, base, 0); \
29 + if (tmp > UINT_MAX) \
31 + variable = convert ((unsigned long int)tmp); \
34 else if (terminator_p (*endp)) \
36 # define INT_FIELD_MAYBE_NULL(variable, terminator_p, swallow, base, convert, default) \
39 + unsigned long long tmp; \
41 /* We expect some more input, so don't allow the string to end here. */ \
43 - variable = convert (strtou32 (line, &endp, base)); \
44 + /* Prevent from 32-bit overflow. */ \
45 + tmp = __strtoull_internal (line, &endp, base, 0); \
46 + if (tmp > UINT_MAX) \
48 + variable = convert ((unsigned long int)tmp); \
51 if (terminator_p (*endp)) \