mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 08:05:21 +00:00
Fix assertion failure in parsing NSAP records from text
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
|||||||
|
4177. [bug] Fix assertion failure in parsing NSAP records from
|
||||||
|
text. [RT #40285]
|
||||||
|
|
||||||
4176. [bug] Address race issues with lwresd. [RT #40284]
|
4176. [bug] Address race issues with lwresd. [RT #40284]
|
||||||
|
|
||||||
4175. [bug] TKEY with GSS-API keys needed bigger buffers.
|
4175. [bug] TKEY with GSS-API keys needed bigger buffers.
|
||||||
|
21
bin/tests/system/checkzone/zones/bad-nsap-empty.db
Normal file
21
bin/tests/system/checkzone/zones/bad-nsap-empty.db
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
; Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
;
|
||||||
|
; Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
; purpose with or without fee is hereby granted, provided that the above
|
||||||
|
; copyright notice and this permission notice appear in all copies.
|
||||||
|
;
|
||||||
|
; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
|
; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
; PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
$TTL 600
|
||||||
|
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
|
||||||
|
NS ns
|
||||||
|
ns A 192.0.2.1
|
||||||
|
|
||||||
|
; NSAP with an odd number of hex digits
|
||||||
|
example NSAP 0x47000580005a0000000001e133ffffff000161000
|
21
bin/tests/system/checkzone/zones/bad-nsap-odd-nibble.db
Normal file
21
bin/tests/system/checkzone/zones/bad-nsap-odd-nibble.db
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
; Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
;
|
||||||
|
; Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
; purpose with or without fee is hereby granted, provided that the above
|
||||||
|
; copyright notice and this permission notice appear in all copies.
|
||||||
|
;
|
||||||
|
; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
|
; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
; PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
$TTL 600
|
||||||
|
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
|
||||||
|
NS ns
|
||||||
|
ns A 192.0.2.1
|
||||||
|
|
||||||
|
; empty NSAP address
|
||||||
|
example NSAP 0x
|
21
bin/tests/system/checkzone/zones/good-nsap.db
Normal file
21
bin/tests/system/checkzone/zones/good-nsap.db
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
; Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
;
|
||||||
|
; Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
; purpose with or without fee is hereby granted, provided that the above
|
||||||
|
; copyright notice and this permission notice appear in all copies.
|
||||||
|
;
|
||||||
|
; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
|
; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
; PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
$TTL 600
|
||||||
|
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
|
||||||
|
NS ns
|
||||||
|
ns A 192.0.2.1
|
||||||
|
|
||||||
|
; empty NSAP address
|
||||||
|
example NSAP 0x47.0005.80.005a00.0000....0001.e133.ffffff000162.00
|
@@ -31,7 +31,8 @@ fromtext_in_nsap(ARGS_FROMTEXT) {
|
|||||||
isc_token_t token;
|
isc_token_t token;
|
||||||
isc_textregion_t *sr;
|
isc_textregion_t *sr;
|
||||||
int n;
|
int n;
|
||||||
int digits;
|
isc_boolean_t valid = ISC_FALSE;
|
||||||
|
int digits = 0;
|
||||||
unsigned char c = 0;
|
unsigned char c = 0;
|
||||||
|
|
||||||
REQUIRE(type == 22);
|
REQUIRE(type == 22);
|
||||||
@@ -52,7 +53,6 @@ fromtext_in_nsap(ARGS_FROMTEXT) {
|
|||||||
if (sr->base[0] != '0' || (sr->base[1] != 'x' && sr->base[1] != 'X'))
|
if (sr->base[0] != '0' || (sr->base[1] != 'x' && sr->base[1] != 'X'))
|
||||||
RETTOK(DNS_R_SYNTAX);
|
RETTOK(DNS_R_SYNTAX);
|
||||||
isc_textregion_consume(sr, 2);
|
isc_textregion_consume(sr, 2);
|
||||||
digits = 0;
|
|
||||||
while (sr->length > 0) {
|
while (sr->length > 0) {
|
||||||
if (sr->base[0] == '.') {
|
if (sr->base[0] == '.') {
|
||||||
isc_textregion_consume(sr, 1);
|
isc_textregion_consume(sr, 1);
|
||||||
@@ -64,11 +64,13 @@ fromtext_in_nsap(ARGS_FROMTEXT) {
|
|||||||
c += n;
|
c += n;
|
||||||
if (++digits == 2) {
|
if (++digits == 2) {
|
||||||
RETERR(mem_tobuffer(target, &c, 1));
|
RETERR(mem_tobuffer(target, &c, 1));
|
||||||
|
valid = ISC_TRUE;
|
||||||
digits = 0;
|
digits = 0;
|
||||||
|
c = 0;
|
||||||
}
|
}
|
||||||
isc_textregion_consume(sr, 1);
|
isc_textregion_consume(sr, 1);
|
||||||
}
|
}
|
||||||
if (digits)
|
if (digits != 0 || !valid)
|
||||||
RETTOK(ISC_R_UNEXPECTEDEND);
|
RETTOK(ISC_R_UNEXPECTEDEND);
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user