2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Fix assertion failure in parsing NSAP records from text

This commit is contained in:
Mukund Sivaraman
2015-08-14 12:57:05 +05:30
parent 563878539a
commit 474921d733
5 changed files with 71 additions and 3 deletions

View File

@@ -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]
4175. [bug] TKEY with GSS-API keys needed bigger buffers.

View 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

View 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

View 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

View File

@@ -31,7 +31,8 @@ fromtext_in_nsap(ARGS_FROMTEXT) {
isc_token_t token;
isc_textregion_t *sr;
int n;
int digits;
isc_boolean_t valid = ISC_FALSE;
int digits = 0;
unsigned char c = 0;
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'))
RETTOK(DNS_R_SYNTAX);
isc_textregion_consume(sr, 2);
digits = 0;
while (sr->length > 0) {
if (sr->base[0] == '.') {
isc_textregion_consume(sr, 1);
@@ -64,11 +64,13 @@ fromtext_in_nsap(ARGS_FROMTEXT) {
c += n;
if (++digits == 2) {
RETERR(mem_tobuffer(target, &c, 1));
valid = ISC_TRUE;
digits = 0;
c = 0;
}
isc_textregion_consume(sr, 1);
}
if (digits)
if (digits != 0 || !valid)
RETTOK(ISC_R_UNEXPECTEDEND);
return (ISC_R_SUCCESS);
}