Parcourir la source

[2749] Add comment that we know there's room available in the buffer

Mukund Sivaraman il y a 11 ans
Parent
commit
45809d98ad
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      src/bin/dhcp6/dhcp6_srv.cc

+ 3 - 0
src/bin/dhcp6/dhcp6_srv.cc

@@ -2345,6 +2345,9 @@ Dhcpv6Srv::unpackOptions(const OptionBuffer& buf,
     // The buffer being read comprises a set of options, each starting with
     // The buffer being read comprises a set of options, each starting with
     // a two-byte type code and a two-byte length field.
     // a two-byte type code and a two-byte length field.
     while (offset + 4 <= length) {
     while (offset + 4 <= length) {
+        // At this point, from the while condition, we know that there
+        // are at least 4 bytes available following offset in the
+        // buffer.
         uint16_t opt_type = isc::util::readUint16(&buf[offset], 2);
         uint16_t opt_type = isc::util::readUint16(&buf[offset], 2);
         offset += 2;
         offset += 2;