Skip to content

Commit

Permalink
Returns an error with logging for read_name invalid offset (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
keepsimple1 committed Apr 23, 2023
1 parent 3d61f2d commit 4e7b59d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dns_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,14 @@ impl DnsIncoming {
let mut at_end = false;

loop {
if offset >= data.len() {
return Err(Error::Msg(format!(
"read_name: offset: {} data len {}. DnsIncoming: {:?}",
offset,
data.len(),
self
)));
}
let length = data[offset];
if length == 0 {
if !at_end {
Expand Down

0 comments on commit 4e7b59d

Please sign in to comment.