mirror of https://github.com/getdnsapi/getdns.git
'"' needs to be escaped too in json
This commit is contained in:
parent
c3d0afd47d
commit
71b773ab2f
10
src/dict.c
10
src/dict.c
|
@ -790,12 +790,18 @@ getdns_pp_bindata(gldns_buffer *buf, getdns_bindata *bindata,
|
||||||
if (!gldns_buffer_reserve(buf, (e - s) + 2))
|
if (!gldns_buffer_reserve(buf, (e - s) + 2))
|
||||||
return -1;
|
return -1;
|
||||||
gldns_buffer_write_u8(buf, '"');
|
gldns_buffer_write_u8(buf, '"');
|
||||||
while ((b = memchr(s, '\\', e - s))) {
|
for (;;) {
|
||||||
|
for ( b = s
|
||||||
|
; b < e && *b != '\\' && *b != '"'
|
||||||
|
; b++)
|
||||||
|
; /* pass */
|
||||||
|
if (b == e)
|
||||||
|
break;
|
||||||
if (!gldns_buffer_reserve(buf, (b - s) + 3))
|
if (!gldns_buffer_reserve(buf, (b - s) + 3))
|
||||||
return -1;
|
return -1;
|
||||||
gldns_buffer_write(buf, s, b - s);
|
gldns_buffer_write(buf, s, b - s);
|
||||||
gldns_buffer_write_u8(buf, '\\');
|
gldns_buffer_write_u8(buf, '\\');
|
||||||
gldns_buffer_write_u8(buf, '\\');
|
gldns_buffer_write_u8(buf, *b);
|
||||||
s = b + 1;
|
s = b + 1;
|
||||||
}
|
}
|
||||||
if (s < e)
|
if (s < e)
|
||||||
|
|
Loading…
Reference in New Issue