Pārlūkot izejas kodu

Attempt to fix crash in read response

In some cases when server was rebooted during read, the callback
would access NULL results.

This fixes the crash, but doesn't call the registered application
callback in case results is empty.
Jaakko Laurikainen 6 gadi atpakaļ
vecāks
revīzija
7b777465dc
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      src/client/ua_client_highlevel.c

+ 5 - 0
src/client/ua_client_highlevel.c

@@ -478,6 +478,11 @@ void ValueAttributeRead(UA_Client *client, void *userdata, UA_UInt32 requestId,
         return;
 
     UA_ReadResponse rr = *(UA_ReadResponse *) response;
+    if ((rr.resultsSize == 0) || (rr.results == NULL))
+    {
+        return;
+    }
+
     if (rr.results[0].status != UA_STATUSCODE_GOOD)
         UA_ReadResponse_deleteMembers((UA_ReadResponse*) response);