]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix sldns parse failure for CDS alternate delete syntax empty hex.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 23 Apr 2018 10:35:35 +0000 (10:35 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 23 Apr 2018 10:35:35 +0000 (10:35 +0000)
git-svn-id: file:///svn/unbound/trunk@4646 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/authzone.c
sldns/str2wire.c

index 10933e533be4dde9e79e7c91da5a16b3c35a42f0..7b5ed7ea84390779da89abcf58090972f011b339 100644 (file)
@@ -4,6 +4,7 @@
          config_set_option.
        - auth zone http download stores exact copy of downloaded file,
          including comments in the file.
+       - Fix sldns parse failure for CDS alternate delete syntax empty hex.
 
 20 April 2018: Wouter
        - man page documentation for dns-over-tls forward-addr '#' notation.
index b1b72ae935dc70987fef8ab24d8b123e444d8df3..4ade1fc6273dc265af0d9a014436f04157a3351b 100644 (file)
@@ -4220,6 +4220,11 @@ chunkline_newline_removal(sldns_buffer* buf)
        size_t i, end=sldns_buffer_limit(buf);
        for(i=0; i<end; 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')
                        sldns_buffer_write_u8_at(buf, i, (uint8_t)' ');
        }
index fdb3557540287c8e538db08b747388d53f3d6b38..1a51bb695607a634b0f66f850c9f95b851240918 100644 (file)
@@ -1225,6 +1225,17 @@ int sldns_str2wire_b32_ext_buf(const char* str, uint8_t* rd, size_t* len)
        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)
 {
        const char* s = str;
@@ -1234,7 +1245,7 @@ int sldns_str2wire_hex_buf(const char* str, uint8_t* rd, size_t* len)
                        s++;
                        continue;
                }
-               if(dlen == 0 && *s == '0' && *(s+1) == 0) {
+               if(dlen == 0 && *s == '0' && sldns_is_last_of_string(s+1)) {
                        *len = 0;
                        return LDNS_WIREPARSE_ERR_OK;
                }