Possible bug in g10/g10.c

Christian Biere christianbiere at gmx.de
Thu Feb 23 18:39:17 CET 2006


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") );

The next lines amplify my impression that the above lines are buggy:

    if( highbit )   /* must use UTF8 encoding */
	sl = add_to_strlist2( notation_data, string, utf8_strings );
	sl = add_to_strlist( notation_data, string );

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : /pipermail/attachments/20060223/eb6de251/attachment.pgp

More information about the Gnupg-devel mailing list