opkg_cmd: avoid null pointer dereference in opkg_what_depends_conflicts_cmd()
authorJo-Philipp Wich <jo@mein.io>
Mon, 27 Feb 2017 22:23:59 +0000 (23:23 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 27 Feb 2017 22:24:02 +0000 (23:24 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/opkg_cmd.c

index d0d2877cd32b4020c7bd7f935fd5c70d026c55c2..543eef4abacfe38d2d5bd284e121199332db988b 100644 (file)
@@ -1033,7 +1033,7 @@ opkg_what_depends_conflicts_cmd(enum depend_type what_field_type, int recursive,
 
                        deps = pkg_get_ptr(pkg, (what_field_type == CONFLICTS) ? PKG_CONFLICTS : PKG_DEPENDS);
 
-                       for (cdep = deps; cdep->type; cdep++) {
+                       for (cdep = deps; cdep && cdep->type; cdep++) {
                                if (what_field_type != cdep->type)
                                        continue;