szaszm commented on code in PR #2251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2251#discussion_r3903359556


##########
libminifi/src/provenance/Provenance.cpp:
##########
@@ -339,14 +341,16 @@ bool 
ProvenanceEventRecordImpl::deserialize(io::InputStream &input_stream) {
   for (uint32_t i = 0; i < numAttributes; i++) {
     std::string key;
     {
-      const auto ret = input_stream.read(key);
+      // clamp attribute name / value to 64k (the 16bit length prefix maximum)
+      const auto ret = input_stream.read(key, io::LengthPrefixSize::_16BIT, 
64_KiB);

Review Comment:
   :shrug: 
   The length limit is size_t. It doesn't matter if it's larger by one.



##########
libminifi/src/provenance/Provenance.cpp:
##########
@@ -339,14 +341,16 @@ bool 
ProvenanceEventRecordImpl::deserialize(io::InputStream &input_stream) {
   for (uint32_t i = 0; i < numAttributes; i++) {
     std::string key;
     {
-      const auto ret = input_stream.read(key);
+      // clamp attribute name / value to 64k (the 16bit length prefix maximum)
+      const auto ret = input_stream.read(key, io::LengthPrefixSize::_16BIT, 
64_KiB);
       if (ret == 0 || io::isError(ret)) {
         return false;
       }
     }
     std::string value;
     {
-      const auto ret = input_stream.read(value);
+      // clamp attribute name / value to 64k (the 16bit length prefix maximum)
+      const auto ret = input_stream.read(value, io::LengthPrefixSize::_16BIT, 
64_KiB);

Review Comment:
   :shrug: 
   The length limit is size_t. It doesn't matter if it's larger by one.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to