In __option_is_short(), avoid calling isprint() on key characters outside

the range allowed by that function, resulting in undefined behaviour.
Our undefined behaviour in multibyte locales happened to differ from
glibc's, resulting in errors parsing option strings.

Obtained from:	Corinna Vinschen (Red Hat)
This commit is contained in:
Tim J. Robbins 2005-10-17 12:20:05 +00:00
parent 0cf11d1db4
commit 4c2501483a

View File

@ -1,3 +1,5 @@
/* $FreeBSD$ */
/* Hierarchial argument parsing, layered over getopt.
Copyright (C) 1995-1999,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@ -579,7 +581,7 @@ __NTH (__option_is_short (__const struct argp_option *__opt))
else
{
int __key = __opt->key;
return __key > 0 && isprint (__key);
return __key > 0 && __key < 256 && isprint (__key);
}
}