Browse Source

Fix SEGV accessing null pointer if no data for extension object is NULL

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

Credit to oss-fuzz
Stefan Profanter 6 years ago
parent
commit
c13656674f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/server/ua_nodes.c

+ 1 - 1
src/server/ua_nodes.c

@@ -298,7 +298,7 @@ copyCommonVariableAttributes(UA_VariableNode *node,
     UA_Boolean valueSet = false;
     UA_Boolean valueSet = false;
     if (attr->value.type != NULL && UA_NodeId_equal(&attr->value.type->typeId, &extensionObject)) {
     if (attr->value.type != NULL && UA_NodeId_equal(&attr->value.type->typeId, &extensionObject)) {
         const UA_ExtensionObject *obj = (const UA_ExtensionObject *)attr->value.data;
         const UA_ExtensionObject *obj = (const UA_ExtensionObject *)attr->value.data;
-        if (obj->encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) {
+        if (obj && obj->encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) {
 
 
             /* TODO: Once we generate type description in the nodeset compiler,
             /* TODO: Once we generate type description in the nodeset compiler,
              * UA_findDatatypeByBinary can be made internal to the decoding
              * UA_findDatatypeByBinary can be made internal to the decoding