diff options
author | Marcus Brinkmann <[email protected]> | 2002-06-02 23:09:16 +0000 |
---|---|---|
committer | Marcus Brinkmann <[email protected]> | 2002-06-02 23:09:16 +0000 |
commit | 7892a2a64f46bb4dbbd85d6f70769c1db4bae6ce (patch) | |
tree | 4175f547c7da6facaf7f070acff79c459178850d | |
parent | 2002-06-02 Marcus Brinkmann <[email protected]> (diff) | |
download | gpgme-7892a2a64f46bb4dbbd85d6f70769c1db4bae6ce.tar.gz gpgme-7892a2a64f46bb4dbbd85d6f70769c1db4bae6ce.zip |
2002-06-03 Marcus Brinkmann <[email protected]>
* key.c: Include <ctype.h>.
(_gpgme_key_append_name): Skip one more char when
processing escaped char. Submitted by Marc Mutz <[email protected]>.
Handle hexadecimal encodings. Also reported by Marc. Thanks!
Diffstat (limited to '')
-rw-r--r-- | gpgme/ChangeLog | 7 | ||||
-rw-r--r-- | gpgme/key.c | 30 |
2 files changed, 28 insertions, 9 deletions
diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index d09c4ffe..3074014c 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,10 @@ +2002-06-03 Marcus Brinkmann <[email protected]> + + * key.c: Include <ctype.h>. + (_gpgme_key_append_name): Skip one more char when + processing escaped char. Submitted by Marc Mutz <[email protected]>. + Handle hexadecimal encodings. Also reported by Marc. Thanks! + 2002-06-02 Marcus Brinkmann <[email protected]> * ath.h: Enable the _gpgme_ prefix. Fix all those prefix macros. diff --git a/gpgme/key.c b/gpgme/key.c index 3196014c..94973da3 100644 --- a/gpgme/key.c +++ b/gpgme/key.c @@ -24,6 +24,7 @@ #include <stdlib.h> #include <string.h> #include <assert.h> +#include <ctype.h> #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 { |