public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix argp.h __option_is_short
@ 2006-04-21 12:56 Jakub Jelinek
  2006-04-22 15:09 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2006-04-21 12:56 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers

Hi!

__key larger than 255 is valid in argp, but may crash in isprint.
Fix grabbed from gnu-lib.

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>.

--- libc/argp/argp.h.jj	2005-11-21 12:07:37.000000000 +0100
+++ libc/argp/argp.h	2006-04-21 14:41:39.000000000 +0200
@@ -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
   else
     {
       int __key = __opt->key;
-      return __key > 0 && isprint (__key);
+      return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
     }
 }
 

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix argp.h __option_is_short
  2006-04-21 12:56 [PATCH] Fix argp.h __option_is_short Jakub Jelinek
@ 2006-04-22 15:09 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2006-04-22 15:09 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Roland McGrath, Glibc hackers

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

OK.  But his header needs to be seriously cleaned up.  All internal
definitions should go into a private header.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 253 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-22 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-21 12:56 [PATCH] Fix argp.h __option_is_short Jakub Jelinek
2006-04-22 15:09 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).