aboutsummaryrefslogtreecommitdiff
path: root/jffsX-utils
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2025-01-26 14:42:00 +0800
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2025-01-30 18:30:16 +0100
commit8e8697a4ee2edbc14f16720613cbf408d70eb895 (patch)
tree416cc68f13ed2e1aaaff302771023ca1056a215e /jffsX-utils
parent555a652dfe40619fd316ff7016570734450daf44 (diff)
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 <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'jffsX-utils')
-rw-r--r--jffsX-utils/jffs2reader.c3
1 files changed, 3 insertions, 0 deletions
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;