Skip to content

Commit

Permalink
platforms/nuttx/src/px4/common/usr_mcu_version.cpp: Check pointers gi…
Browse files Browse the repository at this point in the history
…ven as parameters to board_mcu_version

Logger may pass NULL pointer for ERRATA, check all the pointers.

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Oct 29, 2024
1 parent 6e2d42e commit ceec65a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions platforms/nuttx/src/px4/common/usr_mcu_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,17 @@ int board_mcu_version(char *rev, const char **revstr, const char **errata)
unsigned len = sizeof(hw_version_table) / sizeof(hw_version_table[0]);

if (hw_version < len) {
*rev = hw_version_table[hw_version].rev;
*revstr = hw_version_table[hw_version].revstr;
*errata = hw_version_table[hw_version].errata;
if (rev) {
*rev = hw_version_table[hw_version].rev;
}

if (revstr) {
*revstr = hw_version_table[hw_version].revstr;
}

if (errata) {
*errata = hw_version_table[hw_version].errata;
}
}

return hw_version;
Expand Down

0 comments on commit ceec65a

Please sign in to comment.