opkg_cmd: avoid null pointer dereference in opkg_what_depends_conflicts_cmd()
[oweals/opkg-lede.git] / 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;