mirror of
https://github.com/ZeusWPI/ZNS.git
synced 2024-11-21 21:41:10 +01:00
fix wrong condition check
This commit is contained in:
parent
c213ac14f9
commit
cb4812a5c5
1 changed files with 27 additions and 41 deletions
|
@ -158,12 +158,6 @@ impl ToBytes for LabelString {
|
|||
impl FromBytes for Question {
|
||||
fn from_bytes(reader: &mut Reader) -> Result<Self> {
|
||||
// 16 for length octet + zero length octet
|
||||
if reader.unread_bytes() < 2 + size_of::<Class>() + size_of::<Type>() {
|
||||
Err(ZNSError::Parse {
|
||||
object: String::from("Question"),
|
||||
message: String::from("len of bytes smaller then minimum size"),
|
||||
})
|
||||
} else {
|
||||
let qname = LabelString::from_bytes(reader)?;
|
||||
|
||||
if reader.unread_bytes() < 4 {
|
||||
|
@ -185,7 +179,6 @@ impl FromBytes for Question {
|
|||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToBytes for Question {
|
||||
|
@ -200,12 +193,6 @@ impl ToBytes for Question {
|
|||
impl FromBytes for RR {
|
||||
fn from_bytes(reader: &mut Reader) -> Result<Self> {
|
||||
let name = LabelString::from_bytes(reader)?;
|
||||
if reader.unread_bytes() < size_of::<Type>() + size_of::<Class>() + 6 {
|
||||
Err(ZNSError::Parse {
|
||||
object: String::from("RR"),
|
||||
message: String::from("len of rest of bytes smaller then minimum size"),
|
||||
})
|
||||
} else {
|
||||
let _type = Type::from(reader.read_u16()?);
|
||||
let class = Class::from(reader.read_u16()?);
|
||||
let ttl = reader.read_i32()?;
|
||||
|
@ -226,7 +213,6 @@ impl FromBytes for RR {
|
|||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToBytes for RR {
|
||||
|
|
Loading…
Reference in a new issue