summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/argp-standalone/files/0002-isprint.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2015-12-17 08:51:39 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-22 23:42:46 +0000
commitd2bb8bb1406ef1ca53539912a463bd518211110a (patch)
treef29152b64329882658df747c1639cde99407bfdb /meta/recipes-support/argp-standalone/files/0002-isprint.patch
parentf02a8228db795f2c6c8d81cfd7e0b88bf355c1b8 (diff)
downloadopenembedded-core-d2bb8bb1406ef1ca53539912a463bd518211110a.tar.gz
argp-standalone: Add recipe
This helps packages like gnutls to compile with musl any package that needs glibc's implementation of argp can link to this library Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta/recipes-support/argp-standalone/files/0002-isprint.patch')
-rw-r--r--meta/recipes-support/argp-standalone/files/0002-isprint.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/recipes-support/argp-standalone/files/0002-isprint.patch b/meta/recipes-support/argp-standalone/files/0002-isprint.patch
new file mode 100644
index 0000000000..1c07eea3c1
--- /dev/null
+++ b/meta/recipes-support/argp-standalone/files/0002-isprint.patch
@@ -0,0 +1,51 @@
+Subject: restrict value range passed to isprint function
+
+According to C standards isprint argument shall be representable as an
+unsigned char or be equal to EOF, otherwise the behaviour is undefined.
+
+Passing arbitrary ints leads to segfault in nm program from elfutils.
+
+Restrict isprint argument range to values representable by unsigned char.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+
+Taken from buildroot
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+Index: b/argp.h
+===================================================================
+--- a/argp.h
++++ b/argp.h
+@@ -23,6 +23,7 @@
+
+ #include <stdio.h>
+ #include <ctype.h>
++#include <limits.h>
+
+ #define __need_error_t
+ #include <errno.h>
+@@ -577,7 +578,7 @@
+ else
+ {
+ int __key = __opt->key;
+- return __key > 0 && isprint (__key);
++ return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
+ }
+ }
+
+Index: b/argp-parse.c
+===================================================================
+--- a/argp-parse.c
++++ b/argp-parse.c
+@@ -1292,7 +1292,7 @@
+ int __key = __opt->key;
+ /* FIXME: whether or not a particular key implies a short option
+ * ought not to be locale dependent. */
+- return __key > 0 && isprint (__key);
++ return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
+ }
+ }
+