The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / argp-standalone / 0002-isprint.patch
1 Subject: restrict value range passed to isprint function
2
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.
5
6 Passing arbitrary ints leads to segfault in nm program from elfutils.
7
8 Restrict isprint argument range to values representable by unsigned char.
9
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 @@
17  
18  #include <stdio.h>
19  #include <ctype.h>
20 +#include <limits.h>
21  
22  #define __need_error_t
23  #include <errno.h>
24 @@ -577,7 +578,7 @@
25    else
26      {
27        int __key = __opt->key;
28 -      return __key > 0 && isprint (__key);
29 +      return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
30      }
31  }
32  
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);
43      }
44  }
45