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: Allow 0 rows or 0 columns in init_dataset() #363

Closed ian-abbott closed 6 months ago

ian-abbott commented 7 months ago

If the num_of_columns or num_of_rows parameter value is 0, some of the memory allocations will have size 0, so the calls to malloc() may return NULL, causing init_dataset() to return an error. Change the function to only allocate dataset->columns and dataset->types if num_of_columns is not 0, and to only allocate dataset->rows if num_of_rows is not 0, setting the pointers to NULL without returning an error when not allocated.

ian-abbott commented 7 months ago

I corrected the patch description in the force-push.