mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-08 05:34:14 +08:00
mdbx: import - ITS#9068 fix backslash escaping.
mdb_load wasn't properly inserting escaped backslashes into the data. mdb_dump wasn't escaping backslashes when generating printable output. Change-Id: I94796846f77f0af1f50214dde0c701566cc5e9ff
This commit is contained in:
parent
4bfb3ec238
commit
49b83e5adf
@ -67,6 +67,8 @@ static void text(MDB_val *v)
|
|||||||
end = c + v->mv_size;
|
end = c + v->mv_size;
|
||||||
while (c < end) {
|
while (c < end) {
|
||||||
if (isprint(*c)) {
|
if (isprint(*c)) {
|
||||||
|
if (*c == '\\')
|
||||||
|
putchar('\\');
|
||||||
putchar(*c);
|
putchar(*c);
|
||||||
} else {
|
} else {
|
||||||
putchar('\\');
|
putchar('\\');
|
||||||
|
@ -241,7 +241,7 @@ badend:
|
|||||||
while (c2 < end) {
|
while (c2 < end) {
|
||||||
if (*c2 == '\\') {
|
if (*c2 == '\\') {
|
||||||
if (c2[1] == '\\') {
|
if (c2[1] == '\\') {
|
||||||
c1++; c2 += 2;
|
*c1++ = *c2;
|
||||||
} else {
|
} else {
|
||||||
if (c2+3 > end || !isxdigit(c2[1]) || !isxdigit(c2[2])) {
|
if (c2+3 > end || !isxdigit(c2[1]) || !isxdigit(c2[2])) {
|
||||||
Eof = 1;
|
Eof = 1;
|
||||||
@ -249,8 +249,8 @@ badend:
|
|||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
*c1++ = unhex(++c2);
|
*c1++ = unhex(++c2);
|
||||||
c2 += 2;
|
|
||||||
}
|
}
|
||||||
|
c2 += 2;
|
||||||
} else {
|
} else {
|
||||||
/* copies are redundant when no escapes were used */
|
/* copies are redundant when no escapes were used */
|
||||||
*c1++ = *c2++;
|
*c1++ = *c2++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user