Skip to content
Snippets Groups Projects
Commit e7642321 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix getnodedat() error handling and usage

If a file descriptor is passed to getnodedat() and the lock retry counter was
reached, the file would be closed, but the passed file descriptor reference
would not be set to -1. This could result in exceptions (from subsequent read
attempts on the referenced file descriptor) in cases where the node.dab could
not be locked or read by getnodedat() and was thus closed.

The set/get_node_* helper functions (used by MQTT) were not initializing the
node.dab file descriptor (i.e. to -1), so it's possible getnodedat() could
try to read from and close an invalid/wrong open file descriptor. If the local
variable happened to be initialized to a value <= 0, then, no problem, but
this is undefined behavior (UB).
parent 6d7b60d0
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
Pipeline #6477 passed
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment