Possible bug in g10/g10.c

David Shaw dshaw at jabberwocky.com
Thu Feb 23 20:29:25 CET 2006


On Thu, Feb 23, 2006 at 06:39:17PM +0100, Christian Biere wrote:
> Hi,
> 
> due to my siege against misuse of ctype functions I always stumble
> over the compiler warnings in g10/g10.c. If I remember correctly, last
> time I accepted that the compiler is at fault because there are
> isascii() checks. Well, the compiler isn't really at fault if
> isascii() doesn't resolve to something determinable at compile-time.
> Actually, my <ctype.h> really uses a table-reference under some
> circumstances, so the compiler is dead on. That was the prequel.
> 
> Here goes the main issue - taken from g10/g10.c:
> 
>     /* we only support printable text - therefore we enforce the use
>      * of only printable characters (an empty value is valid) */
>     for( s++; *s ; s++ ) {
> 	if ( isascii (*s) ) <<<<< Isn't there a '!' missing?
>           highbit = 1;
> 	else if (iscntrl(*s)) { <<<< Not ASCII, crash likely
> 	    log_error(_("a notation value must not use"
> 			" any control characters\n") );
> 	    return;
> 	}
>     }

That's a bug.  I've fixed it for 1.4.3.  Thanks for the report!

David



More information about the Gnupg-devel mailing list