summaryrefslogtreecommitdiff
path: root/lib/ldb/common/ldb_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ldb/common/ldb_parse.c')
-rw-r--r--lib/ldb/common/ldb_parse.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ldb/common/ldb_parse.c b/lib/ldb/common/ldb_parse.c
index cfa2959194..f47ef43376 100644
--- a/lib/ldb/common/ldb_parse.c
+++ b/lib/ldb/common/ldb_parse.c
@@ -124,7 +124,8 @@ char *ldb_binary_encode(TALLOC_CTX *mem_ctx, struct ldb_val val)
unsigned char *buf = val.data;
for (i=0;i<val.length;i++) {
- if (!isprint(buf[i]) || strchr(" *()\\&|!\"", buf[i])) {
+ unsigned int cval = buf[i];
+ if (cval < 0x20 || cval > 0x7E || strchr(" *()\\&|!\"", buf[i])) {
len += 2;
}
}
@@ -133,7 +134,8 @@ char *ldb_binary_encode(TALLOC_CTX *mem_ctx, struct ldb_val val)
len = 0;
for (i=0;i<val.length;i++) {
- if (!isprint(buf[i]) || strchr(" *()\\&|!\"", buf[i])) {
+ unsigned int cval = buf[i];
+ if (cval < 0x20 || cval > 0x7E || strchr(" *()\\&|!\"", buf[i])) {
snprintf(ret+len, 4, "\\%02X", buf[i]);
len += 3;
} else {