]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
boot: cedit: Check ofnode_read_prop return value
authorFrancois Berder <fberder@outlook.fr>
Mon, 18 May 2026 14:39:27 +0000 (16:39 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 29 May 2026 20:23:11 +0000 (14:23 -0600)
In h_read_settings, val variable could be NULL due to
ofnode_read_prop returning an error. This variable
would then be used as the src in strcpy.

Add a NULL check after calling ofnode_read_prop.

Signed-off-by: Francois Berder <fberder@outlook.fr>
Reviewed-by: Simon Glass <sjg@chromium.org>
boot/cedit.c

index 56dc7c6af15b066e2c958eb9e718ee2dacc62ef8..b1b79d1752a7c9d8146202f684cdfef9a489c797 100644 (file)
@@ -500,6 +500,8 @@ static int h_read_settings(struct scene_obj *obj, void *vpriv)
                tline = (struct scene_obj_textline *)obj;
 
                val = ofnode_read_prop(node, obj->name, &len);
+               if (!val)
+                       return log_msg_ret("tline", -ENOENT);
                if (len >= tline->max_chars)
                        return log_msg_ret("str", -ENOSPC);
                strcpy(abuf_data(&tline->buf), val);