Merge pull request #5857

e907305 ITS#9068 fix backslash escaping (hyc)
This commit is contained in:
luigi1111 2019-09-08 20:07:34 -05:00
commit 93699a27f7
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
2 changed files with 4 additions and 2 deletions

View File

@ -64,6 +64,8 @@ static void text(MDB_val *v)
end = c + v->mv_size;
while (c < end) {
if (isprint(*c)) {
if (*c == '\\')
putchar('\\');
putchar(*c);
} else {
putchar('\\');

View File

@ -236,7 +236,7 @@ badend:
while (c2 < end) {
if (*c2 == '\\') {
if (c2[1] == '\\') {
c1++; c2 += 2;
*c1++ = *c2;
} else {
if (c2+3 > end || !isxdigit(c2[1]) || !isxdigit(c2[2])) {
Eof = 1;
@ -244,8 +244,8 @@ badend:
return EOF;
}
*c1++ = unhex(++c2);
c2 += 2;
}
c2 += 2;
} else {
/* copies are redundant when no escapes were used */
*c1++ = *c2++;