eclipse / tahu

Eclipse Tahu addresses the existence of legacy SCADA/DCS/ICS protocols and infrastructures and provides a much-needed definition of how best to apply MQTT into these existing industrial operational environments.
https://eclipse.org/tahu
Eclipse Public License 2.0
221 stars 129 forks source link

c/core: Fix possible clean-up problem in init_dataset() #359

Closed ian-abbott closed 7 months ago

ian-abbott commented 7 months ago

If there is a memory allocation failure when copying the column keys, the dynamically allocated dataset->columns[] array is left in an inconsistent state because remaining elements are left in an uninitialized state. If the dataset is later cleaned up with pb_release(), it will try and free memory referenced by these uninitialized dataset->columns[] elements leading to undefined behavior. Fix it by setting the remaining dataset->columns[] elements to NULL on failure.

Fixes #357.