Skip to content
Snippets Groups Projects
Commit cfa84954 authored by Beat Küng's avatar Beat Küng Committed by Lorenz Meier
Browse files

param_get: add null-pointer check

If param_find() returned PARAM_INVALID, and this was directly passed to
param_get(), param_get_value_ptr() returned null and we read garbage data
(or segfaulted on systems with virtual memory).
On px4fmu-v2, this happened for the param ATT_VIBE_THRESH in sensors.
Because of the recently added parameter scoping, this param got pruned, as
it's defined in attitude_estimator_q.

credits for finding this go to Jeyong Shin (jeyong).
parent 3e88b2f2
No related branches found
No related tags found
No related merge requests found
......@@ -531,7 +531,7 @@ param_get(param_t param, void *val)
const void *v = param_get_value_ptr(param);
if (val != NULL) {
if (val && v) {
memcpy(val, v, param_size(param));
result = 0;
}
......
......@@ -548,7 +548,7 @@ param_get(param_t param, void *val)
const void *v = param_get_value_ptr(param);
if (val != NULL) {
if (val && v) {
memcpy(val, v, param_size(param));
result = 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment