Przeglądaj źródła

Merge #618

618: dns: fix label-length validation r=Dirbaio a=crawford

The label length is represented by a single byte with the two most-significant bits reserved, which gives a maximum length of 63.

Co-authored-by: Alex Crawford <smoltcp@code.acrawford.com>
bors[bot] 2 lat temu
rodzic
commit
cae682e088
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      src/socket/dns.rs

+ 1 - 1
src/socket/dns.rs

@@ -178,7 +178,7 @@ impl<'a> DnsSocket<'a> {
         let mut raw_name: Vec<u8, MAX_NAME_LEN> = Vec::new();
 
         for s in name.split(|&c| c == b'.') {
-            if s.len() > 255 {
+            if s.len() > 63 {
                 net_trace!("invalid name: too long label");
                 return Err(Error::Illegal);
             }