Ver código fonte

prevent a segfault in ClientNetworkLayerGetBuffer

Holger Jeromin 9 anos atrás
pai
commit
3dee3beb88
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2 0
      examples/networklayer_tcp.c

+ 2 - 0
examples/networklayer_tcp.c

@@ -450,6 +450,8 @@ UA_ServerNetworkLayer ServerNetworkLayerTCP_new(UA_ConnectionConfig conf, UA_UIn
 
 static UA_StatusCode ClientNetworkLayerGetBuffer(UA_Connection *connection, UA_ByteString *buf) {
 #ifndef UA_MULTITHREADING
+    if(connection->state == UA_CONNECTION_CLOSED)
+        return UA_STATUSCODE_BADCONNECTIONCLOSED;
     *buf = *(UA_ByteString*)connection->handle;
     return UA_STATUSCODE_GOOD;
 #else