changeset 11562:d0742bd1f0f8

argp: avoid undefined behavior * lib/argp-fmtstream.c (weak_alias): Pass correct types to ctype macros. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Mon, 11 May 2009 05:54:20 -0600
parents 3485e4d3bbdb
children 861b812ba15f
files ChangeLog lib/argp-fmtstream.c
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-05-11  Eric Blake  <ebb9@byu.net>
+
+	argp: avoid undefined behavior
+	* lib/argp-fmtstream.c (weak_alias): Pass correct types to ctype
+	macros.
+
 2009-05-08  Simon Josefsson  <simon@josefsson.org>
 
 	* 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  <dtbartle@csclub.uwaterloo.ca>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	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  <dtbartle@csclub.uwaterloo.ca>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	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  <meyering@redhat.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	* lib/propername.c (proper_name_utf8): Ignore no-op translations;
 	use the converted UTF-8 variant of the name instead.
--- a/lib/argp-fmtstream.c
+++ b/lib/argp-fmtstream.c
@@ -226,7 +226,7 @@
 	  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 @@
 	      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 @@
 	      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 @@
 	      /* Swallow separating blanks.  */
 	      do
 		++p;
-	      while (isblank (*p));
+	      while (isblank ((unsigned char) *p));
 	      /* The next line will start here.  */
 	      nextline = p;
 	    }