From: Marcus Brinkmann Date: Sun, 2 Jun 2002 23:09:16 +0000 (+0000) Subject: 2002-06-03 Marcus Brinkmann X-Git-Tag: gpgme-1.2.0@1385~970 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4c1d4b1fa737a6168627f3d9f1b057b32c75ae35;p=gpgme.git 2002-06-03 Marcus Brinkmann * key.c: Include . (_gpgme_key_append_name): Skip one more char when processing escaped char. Submitted by Marc Mutz . Handle hexadecimal encodings. Also reported by Marc. Thanks! --- diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index d09c4ff..3074014 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,3 +1,10 @@ +2002-06-03 Marcus Brinkmann + + * key.c: Include . + (_gpgme_key_append_name): Skip one more char when + processing escaped char. Submitted by Marc Mutz . + Handle hexadecimal encodings. Also reported by Marc. Thanks! + 2002-06-02 Marcus Brinkmann * ath.h: Enable the _gpgme_ prefix. Fix all those prefix macros. diff --git a/trunk/gpgme/key.c b/trunk/gpgme/key.c index 3196014..94973da 100644 --- a/trunk/gpgme/key.c +++ b/trunk/gpgme/key.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "util.h" #include "ops.h" @@ -627,17 +628,28 @@ _gpgme_key_append_name (GpgmeKey key, const char *s) *d++ = '\\'; *d++ = '\0'; } - else if (s[1] == 'x' && my_isdigit (s[2]) && my_isdigit (s[3])) + else if (s[1] == 'x' && isxdigit (s[2]) && isxdigit (s[3])) { - unsigned int val = (s[2]-'0')*16 + (s[3]-'0'); - if (!val) + int val = hextobyte (&s[2]); + if (val == -1) { - *d++ = '\\'; - *d++ = '\0'; - } - else - *(byte*)d++ = val; - s += 3; + /* Should not happen. */ + *d++ = *s++; + *d++ = *s++; + *d++ = *s++; + *d++ = *s++; + } + else + { + if (!val) + { + *d++ = '\\'; + *d++ = '\0'; + } + else + *(byte*)d++ = val; + s += 4; + } } else {