Fix assertion failure in parsing UNSPEC(103) RR from text (#40274)

This commit is contained in:
Mukund Sivaraman
2015-08-14 13:25:52 +05:30
parent 474921d733
commit 984d2bb9e5
3 changed files with 28 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
4178. [bug] Fix assertion failure in parsing UNSPEC(103) RR from
text. [RT #40274]
4177. [bug] Fix assertion failure in parsing NSAP records from
text. [RT #40285]

View File

@@ -0,0 +1,19 @@
; 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
example IN TYPE103 ^# 1 00

View File

@@ -1748,8 +1748,12 @@ atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
if ((token.value.as_ulong % 4) != 0U)
isc_buffer_subtract(target, 4 - (token.value.as_ulong % 4));
if ((token.value.as_ulong % 4) != 0U) {
unsigned long padding = 4 - (token.value.as_ulong % 4);
if (isc_buffer_usedlength(target) < padding)
return (DNS_R_SYNTAX);
isc_buffer_subtract(target, padding);
}
/*
* Checksum.