aboutsummaryrefslogtreecommitdiff
path: root/external/db_drivers
diff options
context:
space:
mode:
authorHoward Chu <hyc@openldap.org>2019-08-26 17:51:53 +0100
committerHoward Chu <hyc@symas.com>2019-08-26 17:59:13 +0100
commite907305c6c5ee722519ef67911e386490b9a23af (patch)
tree1c6d22e4e2c5f72453b39ec4f94c8f8ab3380c95 /external/db_drivers
parentMerge pull request #5827 (diff)
downloadmonero-e907305c6c5ee722519ef67911e386490b9a23af.tar.xz
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.
Diffstat (limited to 'external/db_drivers')
-rw-r--r--external/db_drivers/liblmdb/mdb_dump.c2
-rw-r--r--external/db_drivers/liblmdb/mdb_load.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/external/db_drivers/liblmdb/mdb_dump.c b/external/db_drivers/liblmdb/mdb_dump.c
index b7737f12d..068dab5a8 100644
--- a/external/db_drivers/liblmdb/mdb_dump.c
+++ b/external/db_drivers/liblmdb/mdb_dump.c
@@ -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('\\');
diff --git a/external/db_drivers/liblmdb/mdb_load.c b/external/db_drivers/liblmdb/mdb_load.c
index ad911c088..e900ae660 100644
--- a/external/db_drivers/liblmdb/mdb_load.c
+++ b/external/db_drivers/liblmdb/mdb_load.c
@@ -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++;