python-cryptography: bump to version 1.7.2
[buildroot-gz.git] / package / argp-standalone / 0002-isprint.patch
blob9c08366f686254636de1b2723fc274a9e2e5f4a7
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>
11 ---
12 Index: b/argp.h
13 ===================================================================
14 --- a/argp.h
15 +++ b/argp.h
16 @@ -23,6 +23,7 @@
18 #include <stdio.h>
19 #include <ctype.h>
20 +#include <limits.h>
22 #define __need_error_t
23 #include <errno.h>
24 @@ -577,7 +578,7 @@
25 else
27 int __key = __opt->key;
28 - return __key > 0 && isprint (__key);
29 + return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
33 Index: b/argp-parse.c
34 ===================================================================
35 --- a/argp-parse.c
36 +++ b/argp-parse.c
37 @@ -1292,7 +1292,7 @@
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);