Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
6ed167ad
Commit
6ed167ad
authored
Jul 15, 2020
by
Mark Andrews
Committed by
Michał Kępień
Aug 05, 2020
Browse files
Always keep a copy of the message
this allows it to be available even when dns_message_parse() returns a error.
parent
348ba25d
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/dns/message.c
View file @
6ed167ad
...
...
@@ -1712,6 +1712,19 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source,
msg
->
header_ok
=
0
;
msg
->
question_ok
=
0
;
if
((
options
&
DNS_MESSAGEPARSE_CLONEBUFFER
)
==
0
)
{
isc_buffer_usedregion
(
&
origsource
,
&
msg
->
saved
);
}
else
{
msg
->
saved
.
length
=
isc_buffer_usedlength
(
&
origsource
);
msg
->
saved
.
base
=
isc_mem_get
(
msg
->
mctx
,
msg
->
saved
.
length
);
if
(
msg
->
saved
.
base
==
NULL
)
{
return
(
ISC_R_NOMEMORY
);
}
memmove
(
msg
->
saved
.
base
,
isc_buffer_base
(
&
origsource
),
msg
->
saved
.
length
);
msg
->
free_saved
=
1
;
}
isc_buffer_remainingregion
(
source
,
&
r
);
if
(
r
.
length
<
DNS_MESSAGE_HEADERLEN
)
return
(
ISC_R_UNEXPECTEDEND
);
...
...
@@ -1787,17 +1800,6 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source,
}
truncated:
if
((
options
&
DNS_MESSAGEPARSE_CLONEBUFFER
)
==
0
)
isc_buffer_usedregion
(
&
origsource
,
&
msg
->
saved
);
else
{
msg
->
saved
.
length
=
isc_buffer_usedlength
(
&
origsource
);
msg
->
saved
.
base
=
isc_mem_get
(
msg
->
mctx
,
msg
->
saved
.
length
);
if
(
msg
->
saved
.
base
==
NULL
)
return
(
ISC_R_NOMEMORY
);
memmove
(
msg
->
saved
.
base
,
isc_buffer_base
(
&
origsource
),
msg
->
saved
.
length
);
msg
->
free_saved
=
1
;
}
if
(
ret
==
ISC_R_UNEXPECTEDEND
&&
ignore_tc
)
return
(
DNS_R_RECOVERABLE
);
...
...
Write
Preview
Markdown
is supported
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