Fix last change.
This commit is contained in:
parent
fbbdd6c6dd
commit
151dda971e
@ -1,3 +1,7 @@
|
|||||||
|
2008-10-24 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* rungpg.c (gpg_keylist_preprocess): Escape backslashes too.
|
||||||
|
|
||||||
2008-10-23 Marcus Brinkmann <marcus@g10code.de>
|
2008-10-23 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* rungpg.c (gpg_keylist_preprocess): Convert percent escaped
|
* rungpg.c (gpg_keylist_preprocess): Convert percent escaped
|
||||||
|
@ -1884,9 +1884,8 @@ gpg_keylist_preprocess (char *line, char **r_line)
|
|||||||
{
|
{
|
||||||
/* The user ID is percent escaped, but we want c-coded.
|
/* The user ID is percent escaped, but we want c-coded.
|
||||||
Because we have to replace each '%HL' by '\xHL', we need at
|
Because we have to replace each '%HL' by '\xHL', we need at
|
||||||
most 4/3 th the number of bytes. But because this
|
most 4/3 th the number of bytes. But because we also need
|
||||||
security software, we err on the good side and allocate
|
to escape the backslashes we allocate twice as much. */
|
||||||
twice as much. */
|
|
||||||
char *uid = malloc (2 * strlen (field[1]) + 1);
|
char *uid = malloc (2 * strlen (field[1]) + 1);
|
||||||
char *src;
|
char *src;
|
||||||
char *dst;
|
char *dst;
|
||||||
@ -1902,14 +1901,17 @@ gpg_keylist_preprocess (char *line, char **r_line)
|
|||||||
*(dst++) = '\\';
|
*(dst++) = '\\';
|
||||||
*(dst++) = 'x';
|
*(dst++) = 'x';
|
||||||
src++;
|
src++;
|
||||||
/* Copy the next two bytes unconditionally. This is
|
/* Copy the next two bytes unconditionally. */
|
||||||
what reduces the maximum number of needed bytes
|
|
||||||
from 2n+1 to (4/3)n+1, even for invalid strings. */
|
|
||||||
if (*src)
|
if (*src)
|
||||||
*(dst++) = *(src++);
|
*(dst++) = *(src++);
|
||||||
if (*src)
|
if (*src)
|
||||||
*(dst++) = *(src++);
|
*(dst++) = *(src++);
|
||||||
}
|
}
|
||||||
|
else if (*src == '\\')
|
||||||
|
{
|
||||||
|
*dst++ = '\\';
|
||||||
|
*dst++ = '\\';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
*(dst++) = *(src++);
|
*(dst++) = *(src++);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user