(__option_is_short): Check upper limit of __key.
authorSergey Poznyakoff <gray@gnu.org.ua>
Thu, 16 Jun 2005 11:52:34 +0000 (11:52 +0000)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 16 Jun 2005 11:52:34 +0000 (11:52 +0000)
Isprint() requires its argument to have the value of an
unsigned char or EOF.

lib/argp.h

index 9bd2030..f06542a 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <getopt.h>
+#include <limits.h>
 
 #define __need_error_t
 #include <errno.h>
@@ -579,7 +580,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);
     }
 }