]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3991] Fixed CWE 570 unsignedLessThanZero
authorFrancis Dupont <fdupont@isc.org>
Tue, 12 May 2026 07:36:15 +0000 (09:36 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 27 May 2026 20:03:01 +0000 (22:03 +0200)
src/lib/dhcp/option_data_types.h

index efbe752364bb84292a255df28ce925990e8b8817..fc4e193a41c94c8748f6d2a852ad048d246d72e4 100644 (file)
@@ -470,7 +470,8 @@ public:
                       " by readInteger is unsupported integer type");
         }
 
-        if (buf.size() < OptionDataTypeTraits<T>::len) {
+        if ((OptionDataTypeTraits<T>::len > 0) &&
+            (buf.size() < OptionDataTypeTraits<T>::len)) {
             isc_throw(isc::dhcp::BadDataTypeCast,
                       "failed to read an integer value from a buffer"
                       << " - buffer is truncated.");