소스 검색

Remove unnecessary length check from CAA records

Because the remaining length was calculated _based on_ the stated length, the condition would always hold.

It turns out that there are many other record types that use "the remainder of the record" to hold bytes, but at the time, CAA was the only one I knew of.
Benjamin Sago 4 년 전
부모
커밋
b7cc51f727
1개의 변경된 파일1개의 추가작업 그리고 10개의 파일을 삭제
  1. 1 10
      dns/src/record/caa.rs

+ 1 - 10
dns/src/record/caa.rs

@@ -59,16 +59,7 @@ impl Wire for CAA {
         let value = String::from_utf8_lossy(&value_buf).to_string();
         trace!("Parsed value -> {:?}", value);
 
-        let got_length = 1 + 1 + u16::from(tag_length) + remaining_length;
-        if stated_length == got_length {
-            // This one’s a little weird, because remaining_len is based on len
-            trace!("Length is correct");
-            Ok(Self { critical, tag, value })
-        }
-        else {
-            warn!("Length is incorrect (stated length {:?}, flags plus tag plus data length {:?}", stated_length, got_length);
-            Err(WireError::WrongLabelLength { stated_length, length_after_labels: got_length })
-        }
+        Ok(Self { critical, tag, value })
     }
 }