1 Subject: restrict value range passed to isprint function
3 According to C standards isprint argument shall be representable as an
4 unsigned char or be equal to EOF, otherwise the behaviour is undefined.
6 Passing arbitrary ints leads to segfault in nm program from elfutils.
8 Restrict isprint argument range to values representable by unsigned char.
10 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
13 ===================================================================
22 #define __need_error_t
27 int __key = __opt->key;
28 - return __key > 0 && isprint (__key);
29 + return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
34 ===================================================================
38 int __key = __opt->key;
39 /* FIXME: whether or not a particular key implies a short option
40 * ought not to be locale dependent. */
41 - return __key > 0 && isprint (__key);
42 + return __key > 0 && __key <= UCHAR_MAX && isprint (__key);