mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- First fix for zero b64 and hex text zone format in sldns.
git-svn-id: file:///svn/unbound/trunk@4247 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
e7260518ea
commit
542162b4e0
3 changed files with 15 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
26 June 2017: Wouter
|
||||
- Better fixup of dnscrypt_cert_chacha test for different escapes.
|
||||
- First fix for zero b64 and hex text zone format in sldns.
|
||||
|
||||
23 June 2017: Wouter
|
||||
- (for 1.6.5): fixup of dnscrypt_cert_chacha test (from Manu Bretelle).
|
||||
|
|
|
|||
|
|
@ -1190,6 +1190,10 @@ int sldns_str2wire_b64_buf(const char* str, uint8_t* rd, size_t* len)
|
|||
{
|
||||
size_t sz = sldns_b64_pton_calculate_size(strlen(str));
|
||||
int n;
|
||||
if(strcmp(str, "0") == 0) {
|
||||
*len = 0;
|
||||
return LDNS_WIREPARSE_ERR_OK;
|
||||
}
|
||||
if(*len < sz)
|
||||
return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
|
||||
n = sldns_b64_pton(str, rd, *len);
|
||||
|
|
@ -1223,6 +1227,10 @@ int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len)
|
|||
s++;
|
||||
continue;
|
||||
}
|
||||
if(dlen == 0 && *s == '0' && *(s+1) == 0) {
|
||||
*len = 0;
|
||||
return LDNS_WIREPARSE_ERR_OK;
|
||||
}
|
||||
if(!isxdigit((unsigned char)*s))
|
||||
return RET_ERR(LDNS_WIREPARSE_ERR_SYNTAX_HEX, s-str);
|
||||
if(*len < dlen/2 + 1)
|
||||
|
|
|
|||
|
|
@ -1220,11 +1220,17 @@ static int sldns_wire2str_b64_scan_num(uint8_t** d, size_t* dl, char** s,
|
|||
|
||||
int sldns_wire2str_b64_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
|
||||
{
|
||||
if(*dl == 0) {
|
||||
return sldns_str_print(s, sl, "0");
|
||||
}
|
||||
return sldns_wire2str_b64_scan_num(d, dl, s, sl, *dl);
|
||||
}
|
||||
|
||||
int sldns_wire2str_hex_scan(uint8_t** d, size_t* dl, char** s, size_t* sl)
|
||||
{
|
||||
if(*dl == 0) {
|
||||
return sldns_str_print(s, sl, "0");
|
||||
}
|
||||
return print_remainder_hex("", d, dl, s, sl);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue