From de2ad394de20d687f256d2a1756be083669520d4 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 11 May 2009 05:54:20 -0600 Subject: [PATCH] argp: avoid undefined behavior * lib/argp-fmtstream.c (weak_alias): Pass correct types to ctype macros. Signed-off-by: Eric Blake --- ChangeLog | 12 +++++++++--- lib/argp-fmtstream.c | 8 ++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0dfb024ad8..acf2934703 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-05-11 Eric Blake + + argp: avoid undefined behavior + * lib/argp-fmtstream.c (weak_alias): Pass correct types to ctype + macros. + 2009-05-08 Simon Josefsson * tests/test-vc-list-files-git.sh: Do git config of user.email and @@ -41,7 +47,7 @@ * modules/alignof: New file. 2009-05-04 David Bartley - Bruno Haible + Bruno Haible Fix test-file-has-acl on FreeBSD. * tests/test-file-has-acl.sh: Also test a directory. On FreeBSD, the @@ -74,7 +80,7 @@ * top/maint.mk (no-submodule-changes): Don't assume a srcdir build. 2009-05-04 David Bartley - Bruno Haible + Bruno Haible acl: Fix infinite loop on FreeBSD. * lib/acl_entries.c (acl_entries) [Linux, FreeBSD]: Fix interpretation @@ -141,7 +147,7 @@ * tests/test-priv-set.c: New file. 2009-05-03 Jim Meyering - Bruno Haible + Bruno Haible * lib/propername.c (proper_name_utf8): Ignore no-op translations; use the converted UTF-8 variant of the name instead. diff --git a/lib/argp-fmtstream.c b/lib/argp-fmtstream.c index c89a99ca1c..7e6d9c6982 100644 --- a/lib/argp-fmtstream.c +++ b/lib/argp-fmtstream.c @@ -226,7 +226,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) int i; p = buf + (r + 1 - fs->point_col); - while (p >= buf && !isblank (*p)) + while (p >= buf && !isblank ((unsigned char) *p)) --p; nextline = p + 1; /* This will begin the next line. */ @@ -236,7 +236,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) if (p >= buf) do --p; - while (p >= buf && isblank (*p)); + while (p >= buf && isblank ((unsigned char) *p)); nl = p + 1; /* The newline will replace the first blank. */ } else @@ -248,7 +248,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) if (p < nl) do ++p; - while (p < nl && !isblank (*p)); + while (p < nl && !isblank ((unsigned char) *p)); if (p == nl) { /* It already ends a line. No fussing required. */ @@ -261,7 +261,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) /* Swallow separating blanks. */ do ++p; - while (isblank (*p)); + while (isblank ((unsigned char) *p)); /* The next line will start here. */ nextline = p; } -- 2.30.2