argp-standalone: restrict value range passed to isprint function
authorMax Filippov <jcmvbkbc@gmail.com>
Tue, 28 Apr 2015 08:50:36 +0000 (11:50 +0300)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fri, 1 May 2015 09:01:33 +0000 (11:01 +0200)
commit30a3b08c1766561b17ef36dcd868a53917665a28
treeb647ff930ecefb49c90a84bcc864c4f4687a8ba5
parent90d63bdefdf766e8660ebfadc35f8e1b8e37b49c
argp-standalone: 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.

Note: a similar change was done to the internal argp implementation of
glibc in commit
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=9055724a92433ffa4c36f93d918ee1b3dfa1d6f7.

[Thomas: add a reference to the corresponding glibc fix.]

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/argp-standalone/0002-isprint.patch [new file with mode: 0644]