Explorar o código

Fix heap buffer overflow if exchangeBuffer did not help

see https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4496

Credit to oss-fuzz
Stefan Profanter %!s(int64=7) %!d(string=hai) anos
pai
achega
dd29bac3dc
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/ua_types_encoding_binary.c

+ 1 - 1
src/ua_types_encoding_binary.c

@@ -1412,7 +1412,7 @@ UA_encodeBinaryInternal(const void *src, const UA_DataType *type) {
                 ptr -= member->padding + memSize; /* encode the same member in the next iteration */
                 if(ret == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED || g_pos + memSize > g_end) {
                     /* the send buffer is too small to encode the member, even after exchangeBuffer */
-                    return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED;
+                    return UA_STATUSCODE_BADRESPONSETOOLARGE;
                 }
                 --i;
             }