about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-04-22 15:10:30 +0000
committerUlrich Drepper <drepper@redhat.com>2006-04-22 15:10:30 +0000
commit9055724a92433ffa4c36f93d918ee1b3dfa1d6f7 (patch)
treed1b47b459446913c51533a832c412fdd98e1afc2
parent41a3975907cfb52ee62199ae8fc287164e2f1cb5 (diff)
downloadglibc-9055724a92433ffa4c36f93d918ee1b3dfa1d6f7.tar.gz
glibc-9055724a92433ffa4c36f93d918ee1b3dfa1d6f7.tar.xz
glibc-9055724a92433ffa4c36f93d918ee1b3dfa1d6f7.zip
* argp/argp.h (__option_is_short): Check upper limit of
	__key.  isprint() requires its argument to have the value
	of an unsigned char or EOF.
	Patch by Sergey Poznyakoff <gray@Mirddin.farlep.net>.
-rw-r--r--ChangeLog7
-rw-r--r--argp/argp.h5
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d9f1cc2e94..10daff82bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-04-21  Jakub Jelinek  <jakub@redhat.com>
+
+	* argp/argp.h (__option_is_short): Check upper limit of
+	__key.  isprint() requires its argument to have the value
+	of an unsigned char or EOF.
+	Patch by Sergey Poznyakoff <gray@Mirddin.farlep.net>.
+
 2006-04-21  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #2534, BZ #2535]
diff --git a/argp/argp.h b/argp/argp.h
index f310193458..3a5cb01fd8 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -1,5 +1,5 @@
 /* Hierarchial argument parsing, layered over getopt.
-   Copyright (C) 1995-1999,2003,2004,2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999,2003,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <getopt.h>
+#include <limits.h>
 
 #define __need_error_t
 #include <errno.h>
@@ -574,7 +575,7 @@ __NTH (__option_is_short (__const struct argp_option *__opt))
   else
     {
       int __key = __opt->key;
-      return __key > 0 && isprint (__key);
+      return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
     }
 }