Skip to content

Conversation

nandojve
Copy link
Member

There are several references to objects[1] at updatehub_probe function. The structures are decoded from json, and have a maximum length of 2. However, if the returned json only has a single element in this array, this objects[1] value will be uninitialized. Because the structure contains pointers, these will be uninitialized, causing the code to reference uninitialized memory as pointers.

Add zeroing memory before passing it to the JSON API and do check if objects_len field is two.

Fixes #27718.

Signed-off-by: Gerson Fernando Budke [email protected]

There are several references to objects[1] at updatehub_probe function.
The structures are decoded from json, and have a maximum length of 2.
However, if the returned json only has a single element in this array,
this objects[1] value will be uninitialized. Because the structure
contains pointers, these will be uninitialized, causing the code to
reference uninitialized memory as pointers.

Add zeroing memory before passing it to the JSON API and do check if
objects_len field is two.

Fixes zephyrproject-rtos#27718.

Signed-off-by: Gerson Fernando Budke <[email protected]>
@nandojve nandojve added this to the v2.4.0 milestone Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updatehub might dereference an uninitialized pointer
6 participants