From 018b48569297b7319cad88d8e94e2fb406304117 Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Tue, 22 Sep 2009 16:07:19 +0000 Subject: [PATCH] Fix Segmentation fault while data in Package.gz is not good While setting up a personal opkg feed, I encountered a crash in opgk when trying to install the package from the repository. Instead of an error message from opkg, it just gave me "Segmentation fault" and exited. Thanks to EdorFaus http://groups.google.com/group/opkg-devel/browse_thread/thread/9620711475fa98d2 git-svn-id: http://opkg.googlecode.com/svn/trunk@218 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- libopkg/opkg_download.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c index 999dc87..f185f22 100644 --- a/libopkg/opkg_download.c +++ b/libopkg/opkg_download.c @@ -209,6 +209,10 @@ int opkg_download_pkg(opkg_conf_t *conf, pkg_t *pkg, const char *dir) pkg->name, pkg->parent->name); return -1; } + if (pkg->filename == NULL) { + opkg_message(conf,OPKG_ERROR, "ERROR: Package %s (parent %s) does not have a valid filename field.\n",pkg->name, pkg->parent->name); + return -1; + } sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture); opkg_set_current_state (conf, OPKG_STATE_DOWNLOADING_PKG, pkgid); -- 2.30.2