Azure / azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-c
Other
588 stars 740 forks source link

Incorrect handle passed to Unsubscribe_InputQueue #2399

Closed Cavaler closed 1 year ago

Cavaler commented 1 year ago

In iothub_client/src/iothub_client_core_ll.c, in function remove_event_unsubscribe_if_needed(), incorrect handle passed in call to IoTHubTransport_Unsubscribe_InputQueue(), resulting in SIGSEGV.

It should be transport handle, not client handle: handleData->IoTHubTransport_Unsubscribe_InputQueue(handleData->transportHandle);

Cavaler commented 1 year ago

Patch for release 1.9.1:

--- iothub_client/src/iothub_client_core_ll.c.orig  2022-11-11 20:50:54.994743800 +0200
+++ iothub_client/src/iothub_client_core_ll.c   2022-11-11 21:02:53.297248700 +0200
@@ -2919,7 +2919,7 @@
             {
                 if (singlylinkedlist_get_head_item(handleData->event_callbacks) == NULL)
                 {
-                    handleData->IoTHubTransport_Unsubscribe_InputQueue(handleData);
+                    handleData->IoTHubTransport_Unsubscribe_InputQueue(handleData->transportHandle);
                 }
                 result = IOTHUB_CLIENT_OK;
             }