Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
ee237802
Commit
ee237802
authored
Jan 04, 2019
by
Mark Andrews
Browse files
maybe_numeric failed to handle NUL in text region.
parent
287bb7b4
Pipeline
#8591
passed with stages
in 22 minutes and 29 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
ee237802
5127. [bug] rcode.c:maybe_numeric failed to handle NUL in text
regions. [GL #807]
5126. [bug] Named incorrectly accepted empty base64 and hex encoded
fields when reading master files. [GL #807]
...
...
lib/dns/rcode.c
View file @
ee237802
...
...
@@ -226,28 +226,36 @@ maybe_numeric(unsigned int *valuep, isc_textregion_t *source,
isc_result_t
result
;
uint32_t
n
;
char
buffer
[
NUMBERSIZE
];
int
v
;
if
(
!
isdigit
(
source
->
base
[
0
]
&
0xff
)
||
source
->
length
>
NUMBERSIZE
-
1
)
{
return
(
ISC_R_BADNUMBER
);
}
/*
* We have a potential number. Try to parse it with
* isc_parse_uint32(). isc_parse_uint32() requires
* null termination, so we must make a copy.
*/
snprintf
(
buffer
,
sizeof
(
buffer
),
"%.*s"
,
(
int
)
source
->
length
,
source
->
base
);
v
=
snprintf
(
buffer
,
sizeof
(
buffer
),
"%.*s"
,
(
int
)
source
->
length
,
source
->
base
);
if
(
v
<
0
||
(
unsigned
)
v
!=
source
->
length
)
{
return
(
ISC_R_BADNUMBER
);
}
INSIST
(
buffer
[
source
->
length
]
==
'\0'
);
result
=
isc_parse_uint32
(
&
n
,
buffer
,
10
);
if
(
result
==
ISC_R_BADNUMBER
&&
hex_allowed
)
if
(
result
==
ISC_R_BADNUMBER
&&
hex_allowed
)
{
result
=
isc_parse_uint32
(
&
n
,
buffer
,
16
);
if
(
result
!=
ISC_R_SUCCESS
)
}
if
(
result
!=
ISC_R_SUCCESS
)
{
return
(
result
);
if
(
n
>
max
)
}
if
(
n
>
max
)
{
return
(
ISC_R_RANGE
);
}
*
valuep
=
n
;
return
(
ISC_R_SUCCESS
);
}
...
...
Mark Andrews
@marka
mentioned in commit
3266d3c4
·
Jan 09, 2019
mentioned in commit
3266d3c4
mentioned in commit 3266d3c4da93ab9bb8b72a9a0092b4bc798177ea
Toggle commit list
Mark Andrews
@marka
mentioned in commit
e216ee68
·
Jan 09, 2019
mentioned in commit
e216ee68
mentioned in commit e216ee68efdf9696de414f981351da38290be1af
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment