]> git.ipfire.org Git - thirdparty/suricata.git/commit
dns: better error handling when parsing names
authorJason Ish <jason.ish@oisf.net>
Tue, 1 Feb 2022 21:44:43 +0000 (15:44 -0600)
committerVictor Julien <vjulien@oisf.net>
Thu, 21 Apr 2022 05:37:05 +0000 (07:37 +0200)
commitf5c65949e87e54f5b7c493c5acfe70844ec78329
treefcd0cd82b96c8d312af51468578e1bc29d5de260
parentf418dbfecb346f0612638b703fb116fd4b08f390
dns: better error handling when parsing names

The DNS name parser will error out with an error even if the
error is incomplete. Instead of manually generating errors,
use '?' to let the nom error ripple up the error handling chain.

The reason this wasn't done in the first place is this code
predates the ? operator, or we were not aware of it at the time.

This prevents the case where probing fails when there is enough data to
parse the header, but not enough to complete name parser. In such a case
a parse error is returned (instead of incomplete) resulting in the
payload not being detected as DNS.

Ticket #5034

(cherry picked from commit 0623ada24df1da99c72bb8cd4959b2cb0e64ccc2)
rust/src/dns/parser.rs