Przeglądaj źródła

fix a corner case with an uninitialized variable

Julius Pfrommer 10 lat temu
rodzic
commit
5c02b6bfda
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      src/ua_types_encoding_binary.c

+ 3 - 1
src/ua_types_encoding_binary.c

@@ -1100,7 +1100,9 @@ UA_StatusCode UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *ds
             ptr += (member->padding >> 3);
             UA_Int32 *noElements = (UA_Int32*)ptr;
             UA_Int32 tempNoElements;
-            UA_Int32_decodeBinary(src, offset, &tempNoElements);
+            retval |= UA_Int32_decodeBinary(src, offset, &tempNoElements);
+            if(retval)
+                continue;
             ptr += sizeof(UA_Int32) + (member->padding & 0x07);
             retval = UA_Array_decodeBinary(src, offset, tempNoElements, (void**)ptr, memberType);
             if(retval == UA_STATUSCODE_GOOD)