Only export default value if set. This may cause an NULL pointer deref. Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> --- common/state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/state.c b/common/state.c index 688c85cf0e7d..124332022662 100644 --- a/common/state.c +++ b/common/state.c @@ -445,14 +445,17 @@ static int state_string_export(struct state_variable *var, struct state_string *string = to_state_string(var); int ret = 0; - if (string->value_default || conv == STATE_CONVERT_FIXUP) { + if (string->value_default) { ret = of_set_property(node, "default", string->value_default, strlen(string->value_default) + 1, 1); - if (ret || conv == STATE_CONVERT_FIXUP) + if (ret) return ret; } + if (conv == STATE_CONVERT_FIXUP) + return 0; + if (string->value) ret = of_set_property(node, "value", string->value, strlen(string->value) + 1, 1); -- 2.1.4 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox