mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 18:44:13 +08:00
mdbx-load: backport - fix backslash escaping (for compatibility with ITS#9068).
In fact MDBX not affected by this bug, since a very long time mdbx_dump was fixed to not produce a problematic sequence of backslash. For compatibility with LMDB after http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=commit;h=5c012bbe033f9bbb273078b07dded59f080d348d Change-Id: I8ff8e003ae29504605402b937becd4fb37120408
This commit is contained in:
parent
b357897745
commit
09cc8c51e2
@ -262,10 +262,9 @@ static int readline(MDBX_val *out, MDBX_val *buf) {
|
|||||||
|
|
||||||
if (mode & PRINT) {
|
if (mode & PRINT) {
|
||||||
while (c2 < end) {
|
while (c2 < end) {
|
||||||
if (*c2 == '\\') {
|
if (unlikely(*c2 == '\\')) {
|
||||||
if (c2[1] == '\\') {
|
if (c2[1] == '\\') {
|
||||||
c1++;
|
*c1++ = '\\';
|
||||||
c2 += 2;
|
|
||||||
} 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;
|
||||||
@ -273,8 +272,8 @@ static int readline(MDBX_val *out, MDBX_val *buf) {
|
|||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
*c1++ = (char)unhex(++c2);
|
*c1++ = (char)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