aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2008-10-24 14:07:14 +0000
committerWerner Koch <[email protected]>2008-10-24 14:07:14 +0000
commit6ce90fccd90e18115471957152ff98fc08e7eb2e (patch)
tree1ca65dc817db7ed1fa24670094cfcb2b633f3e77
parent2008-10-23 Marcus Brinkmann <[email protected]> (diff)
downloadgpgme-6ce90fccd90e18115471957152ff98fc08e7eb2e.tar.gz
gpgme-6ce90fccd90e18115471957152ff98fc08e7eb2e.zip
Fix last change.
-rw-r--r--gpgme/ChangeLog4
-rw-r--r--gpgme/rungpg.c14
2 files changed, 12 insertions, 6 deletions
diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog
index e9d8675e..f848d181 100644
--- a/gpgme/ChangeLog
+++ b/gpgme/ChangeLog
@@ -1,3 +1,7 @@
+2008-10-24 Werner Koch <[email protected]>
+
+ * rungpg.c (gpg_keylist_preprocess): Escape backslashes too.
+
2008-10-23 Marcus Brinkmann <[email protected]>
* rungpg.c (gpg_keylist_preprocess): Convert percent escaped
diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c
index 7524d68f..fc0da117 100644
--- a/gpgme/rungpg.c
+++ b/gpgme/rungpg.c
@@ -1884,9 +1884,8 @@ gpg_keylist_preprocess (char *line, char **r_line)
{
/* The user ID is percent escaped, but we want c-coded.
Because we have to replace each '%HL' by '\xHL', we need at
- most 4/3 th the number of bytes. But because this
- security software, we err on the good side and allocate
- twice as much. */
+ most 4/3 th the number of bytes. But because we also need
+ to escape the backslashes we allocate twice as much. */
char *uid = malloc (2 * strlen (field[1]) + 1);
char *src;
char *dst;
@@ -1902,14 +1901,17 @@ gpg_keylist_preprocess (char *line, char **r_line)
*(dst++) = '\\';
*(dst++) = 'x';
src++;
- /* Copy the next two bytes unconditionally. This is
- what reduces the maximum number of needed bytes
- from 2n+1 to (4/3)n+1, even for invalid strings. */
+ /* Copy the next two bytes unconditionally. */
if (*src)
*(dst++) = *(src++);
if (*src)
*(dst++) = *(src++);
}
+ else if (*src == '\\')
+ {
+ *dst++ = '\\';
+ *dst++ = '\\';
+ }
else
*(dst++) = *(src++);
}