mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix sldns parse failure for CDS alternate delete syntax empty hex.
git-svn-id: file:///svn/unbound/trunk@4646 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
abe18e41bc
commit
0d18256828
3 changed files with 18 additions and 1 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
config_set_option.
|
config_set_option.
|
||||||
- auth zone http download stores exact copy of downloaded file,
|
- auth zone http download stores exact copy of downloaded file,
|
||||||
including comments in the file.
|
including comments in the file.
|
||||||
|
- Fix sldns parse failure for CDS alternate delete syntax empty hex.
|
||||||
|
|
||||||
20 April 2018: Wouter
|
20 April 2018: Wouter
|
||||||
- man page documentation for dns-over-tls forward-addr '#' notation.
|
- man page documentation for dns-over-tls forward-addr '#' notation.
|
||||||
|
|
|
||||||
|
|
@ -4220,6 +4220,11 @@ chunkline_newline_removal(sldns_buffer* buf)
|
||||||
size_t i, end=sldns_buffer_limit(buf);
|
size_t i, end=sldns_buffer_limit(buf);
|
||||||
for(i=0; i<end; i++) {
|
for(i=0; i<end; i++) {
|
||||||
char c = (char)sldns_buffer_read_u8_at(buf, i);
|
char c = (char)sldns_buffer_read_u8_at(buf, i);
|
||||||
|
if(c == '\n' && i==end-1) {
|
||||||
|
sldns_buffer_write_u8_at(buf, i, 0);
|
||||||
|
sldns_buffer_set_limit(buf, end-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(c == '\n')
|
if(c == '\n')
|
||||||
sldns_buffer_write_u8_at(buf, i, (uint8_t)' ');
|
sldns_buffer_write_u8_at(buf, i, (uint8_t)' ');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1225,6 +1225,17 @@ int sldns_str2wire_b32_ext_buf(const char* str, uint8_t* rd, size_t* len)
|
||||||
return LDNS_WIREPARSE_ERR_OK;
|
return LDNS_WIREPARSE_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** see if the string ends, or ends in whitespace */
|
||||||
|
static int
|
||||||
|
sldns_is_last_of_string(const char* str)
|
||||||
|
{
|
||||||
|
if(*str == 0) return 1;
|
||||||
|
while(isspace((unsigned char)*str))
|
||||||
|
str++;
|
||||||
|
if(*str == 0) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len)
|
int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len)
|
||||||
{
|
{
|
||||||
const char* s = str;
|
const char* s = str;
|
||||||
|
|
@ -1234,7 +1245,7 @@ int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len)
|
||||||
s++;
|
s++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(dlen == 0 && *s == '0' && *(s+1) == 0) {
|
if(dlen == 0 && *s == '0' && sldns_is_last_of_string(s+1)) {
|
||||||
*len = 0;
|
*len = 0;
|
||||||
return LDNS_WIREPARSE_ERR_OK;
|
return LDNS_WIREPARSE_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue