mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Make sure that only ascii is passed to isfoo functions.
This commit is contained in:
parent
a72b1e0a57
commit
6a00a17bd1
15 changed files with 66 additions and 31 deletions
|
@ -1,3 +1,16 @@
|
|||
2003-06-07 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* g10.c (add_notation_data): Make sure that only ascii is passed
|
||||
to iscntrl. Noted by Christian Biere.
|
||||
* getkey.c (classify_user_id2): Replaced isspace by spacep
|
||||
* keygen.c (keygen_set_std_prefs): Likewise. Also for isdigit.
|
||||
(ask_user_id): Ditto.
|
||||
(get_parameter_algo): Ditto.
|
||||
* keyedit.c (keyedit_menu): Ditto.
|
||||
* tdbdump.c (import_ownertrust): Ditto. s/isxdigit/hexdigitp/.
|
||||
* revoke.c (ask_revocation_reason):
|
||||
* keyserver.c (keyserver_spawn): Dito.
|
||||
|
||||
2003-06-04 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* options.skel: Use new hkp://subkeys.pgp.net as sample keyserver
|
||||
|
|
|
@ -2876,13 +2876,13 @@ add_notation_data( const char *string, int which )
|
|||
/* we only support printable text - therefore we enforce the use
|
||||
* of only printable characters (an empty value is valid) */
|
||||
for( s++; *s ; s++ ) {
|
||||
if( iscntrl(*s) ) {
|
||||
if ((*s & 0x80))
|
||||
highbit = 1;
|
||||
else if (iscntrl(*s)) {
|
||||
log_error(_("a notation value must not use "
|
||||
"any control characters\n") );
|
||||
return;
|
||||
}
|
||||
else if( *s & 0x80 )
|
||||
highbit = 1;
|
||||
}
|
||||
|
||||
if( highbit ) /* must use UTF8 encoding */
|
||||
|
|
|
@ -569,7 +569,7 @@ classify_user_id2( const char *name,
|
|||
memset (desc, 0, sizeof *desc);
|
||||
*force_exact = 0;
|
||||
/* skip leading spaces. Fixme: what is with trailing spaces? */
|
||||
for(s = name; *s && isspace(*s); s++ )
|
||||
for(s = name; *s && spacep (s); s++ )
|
||||
;
|
||||
|
||||
switch (*s) {
|
||||
|
@ -650,7 +650,7 @@ classify_user_id2( const char *name,
|
|||
}
|
||||
|
||||
/* check if a hexadecimal number is terminated by EOS or blank */
|
||||
if (hexlength && s[hexlength] && !isspace(s[hexlength])) {
|
||||
if (hexlength && s[hexlength] && !spacep(s+hexlength)) {
|
||||
if (hexprefix) /* a "0x" prefix without correct */
|
||||
return 0; /* termination is an error */
|
||||
else /* The first chars looked like */
|
||||
|
|
|
@ -1100,7 +1100,7 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands,
|
|||
cmd = cmdLIST;
|
||||
else if( *answer == CONTROL_D )
|
||||
cmd = cmdQUIT;
|
||||
else if( isdigit( *answer ) ) {
|
||||
else if( digitp(answer ) ) {
|
||||
cmd = cmdSELUID;
|
||||
arg_number = atoi(answer);
|
||||
}
|
||||
|
|
16
g10/keygen.c
16
g10/keygen.c
|
@ -244,17 +244,17 @@ keygen_set_std_prefs (const char *string,int personal)
|
|||
string = "";
|
||||
|
||||
for (s=string; *s; s = s2) {
|
||||
if ((*s=='s' || *s == 'S') && isdigit(s[1]) ) {
|
||||
if ((*s=='s' || *s == 'S') && digitp (s+1) ) {
|
||||
val = strtoul (++s, (char**)&s2, 10);
|
||||
if (set_one_pref (val, 'S', check_cipher_algo, sym, &nsym))
|
||||
rc = -1;
|
||||
}
|
||||
else if ((*s=='h' || *s == 'H') && isdigit(s[1]) ) {
|
||||
else if ((*s=='h' || *s == 'H') && digitp (s+1) ) {
|
||||
val = strtoul (++s, (char**)&s2, 10);
|
||||
if (set_one_pref (val, 'H', check_digest_algo, hash, &nhash))
|
||||
rc = -1;
|
||||
}
|
||||
else if ((*s=='z' || *s == 'Z') && isdigit(s[1]) ) {
|
||||
else if ((*s=='z' || *s == 'Z') && digitp (s+1) ) {
|
||||
val = strtoul (++s, (char**)&s2, 10);
|
||||
if (set_one_pref (val, 'Z', check_compress_algo, zip, &nzip))
|
||||
rc = -1;
|
||||
|
@ -267,7 +267,7 @@ keygen_set_std_prefs (const char *string,int personal)
|
|||
mdc=0;
|
||||
s2=s+6;
|
||||
}
|
||||
else if (isspace (*s))
|
||||
else if (spacep (s))
|
||||
s2 = s+1;
|
||||
else {
|
||||
log_info (_("invalid character in preference string\n"));
|
||||
|
@ -915,10 +915,10 @@ gen_rsa(int algo, unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek,
|
|||
static int
|
||||
check_valid_days( const char *s )
|
||||
{
|
||||
if( !isdigit(*s) )
|
||||
if( !digitp(s) )
|
||||
return 0;
|
||||
for( s++; *s; s++)
|
||||
if( !isdigit(*s) )
|
||||
if( !digitp(s) )
|
||||
break;
|
||||
if( !*s )
|
||||
return 1;
|
||||
|
@ -1252,7 +1252,7 @@ ask_user_id( int mode )
|
|||
|
||||
if( strpbrk( aname, "<>" ) )
|
||||
tty_printf(_("Invalid character in name\n"));
|
||||
else if( isdigit(*aname) )
|
||||
else if( digitp(aname) )
|
||||
tty_printf(_("Name may not start with a digit\n"));
|
||||
else if( strlen(aname) < 5 )
|
||||
tty_printf(_("Name must be at least 5 characters long\n"));
|
||||
|
@ -1522,7 +1522,7 @@ get_parameter_algo( struct para_data_s *para, enum para_name key )
|
|||
struct para_data_s *r = get_parameter( para, key );
|
||||
if( !r )
|
||||
return -1;
|
||||
if( isdigit( *r->u.value ) )
|
||||
if( digitp( r->u.value ) )
|
||||
i = atoi( r->u.value );
|
||||
else
|
||||
i = string_to_pubkey_algo( r->u.value );
|
||||
|
|
|
@ -189,7 +189,7 @@ parse_keyserver_uri(char *uri,const char *configname,unsigned int configlineno)
|
|||
ch=opt.keyserver_port;
|
||||
while(*ch!='\0')
|
||||
{
|
||||
if(!isdigit(*ch))
|
||||
if(!digitp(ch))
|
||||
return G10ERR_BAD_URI;
|
||||
|
||||
ch++;
|
||||
|
@ -569,7 +569,7 @@ keyserver_spawn(int action,STRLIST list,
|
|||
|
||||
/* remove trailing whitespace */
|
||||
plen=strlen(ptr);
|
||||
while(plen>0 && isspace(ptr[plen-1]))
|
||||
while(plen>0 && spacep(ptr+plen-1))
|
||||
plen--;
|
||||
plen[ptr]='\0';
|
||||
|
||||
|
|
|
@ -636,7 +636,7 @@ ask_revocation_reason( int key_rev, int cert_rev, int hint )
|
|||
return NULL; /* cancel */
|
||||
if( hint && !*answer )
|
||||
n = hint;
|
||||
else if(!isdigit( *answer ) )
|
||||
else if(!digitp( answer ) )
|
||||
n = -1;
|
||||
else
|
||||
n = atoi(answer);
|
||||
|
|
|
@ -153,7 +153,7 @@ import_ownertrust( const char *fname )
|
|||
break; /* can't continue */
|
||||
}
|
||||
for(p = line; *p && *p != ':' ; p++ )
|
||||
if( !isxdigit(*p) )
|
||||
if( !hexdigitp(p) )
|
||||
break;
|
||||
if( *p != ':' ) {
|
||||
log_error_f(fname, _("error: missing colon\n") );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue