-
-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numeric truncation when parsing TYPEXX and CLASSXX representation #909
Conversation
@wcawijngaards |
The A better fix would be to make this function return an explicit failure code if the input isn't valid and update the callers of it to handle invalid input. This function is originally from the |
@edmonds |
OK so https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4 |
Hi headshog, thanks for putting in the effort! By looking at the existing code I would return |
@gthess Hi! I've applied changes that you requested. |
Looks good apart from the return type used for |
Done. |
I'll merge it the coming days so it will be part of the next release, thanks again! |
str2wire.c
at lines 2022 and 2067…tation - Fix return values. - Formatting nits.
CLASSXX representation. - For #909: Fix return values.
Hi! We've been fuzzing
unbound
with sydr-fuzz security predicates and we found numeric truncation error instr2wire.c:1978
andstr2wire.c:2023
.In function
sldns_str2wire_nsec_buf
on line 2022 variablet
has typeuint16_t
, functionsldns_get_rr_type_by_name
returns enum typesldns_rr_type
that haveunsigned int
type value. The same is insldns_str2wire_type_buf
on line 2067. This enum has values that >= 65535. Out tool has found input where this function returnsatoi(name + 4)
and its value is bigger than 65535, so the numeric truncation occurs. So we suggest to add an assert checker inif operator
in functionsldns_get_rr_type_by_name
onsldns/rrdef.c:704
:Environment
How to reproduce this error
Build docker container:
Run docker container:
Run on the following input:
Output: