unarchive: fix possible segmentation fault in deb_extract()
[oweals/opkg-lede.git] / libopkg / opkg_cmd.c
index 427b356f0257cc8b76b05f13eebf4d4c7be7f681..543eef4abacfe38d2d5bd284e121199332db988b 100644 (file)
@@ -142,7 +142,7 @@ static int opkg_update_cmd(int argc, char **argv)
                                 list_file_name);
                }
                free(url);
-#if defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
+#if defined(HAVE_USIGN)
                if (pkglist_dl_error == 0 && conf->check_signature) {
                        /* download detached signitures to verify the package lists */
                        /* get the url for the sig 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;
 
@@ -1136,7 +1136,7 @@ opkg_what_provides_replaces_cmd(enum what_field_type what_field_type, int argc,
                                abpkgs = pkg_get_ptr(pkg, (what_field_type == WHATPROVIDES) ? PKG_PROVIDES : PKG_REPLACES);
 
                                while (abpkgs && *abpkgs) {
-                                       apkg = *abpkgs;
+                                       apkg = *abpkgs++;
 
                                        if (fnmatch(target, apkg->name, conf->nocase))
                                                continue;
@@ -1148,7 +1148,6 @@ opkg_what_provides_replaces_cmd(enum what_field_type what_field_type, int argc,
                                                opkg_msg(NOTICE, "\t%s %s\n", rel_str, apkg->name);
 
                                        opkg_message(NOTICE, "\n");
-                                       abpkgs++;
                                }
                        }
                }