From 8e8697a4ee2edbc14f16720613cbf408d70eb895 Mon Sep 17 00:00:00 2001 From: Zhihao Cheng Date: Sun, 26 Jan 2025 14:42:00 +0800 Subject: jffsX-utils: jffs2reader: Fix potential null pointer dereference compiling warning for 'path' The compiler compains following message: jffsX-utils/jffs2reader.c:697:6: warning: potential null pointer dereference It won't bring any problems because the 'path' is guaranteed to be a non-NULL variable. Fix the warning by adding a NULL pointer check. Signed-off-by: Zhihao Cheng Signed-off-by: David Oberhollenzer --- jffsX-utils/jffs2reader.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c index 87a2167..548fc8d 100644 --- a/jffsX-utils/jffs2reader.c +++ b/jffsX-utils/jffs2reader.c @@ -694,6 +694,9 @@ static struct jffs2_raw_dirent *resolvepath0(char *o, size_t size, uint32_t ino, pp = path = xstrdup(p); + if (path == NULL) + return NULL; + if (*path == '/') { path++; ino = 1; -- cgit v1.2.3