summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-09-22 12:07:19 (EDT)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-09-22 12:07:19 (EDT)
commit018b48569297b7319cad88d8e94e2fb406304117 (patch)
treea5445bdb4898787e746d78876c2df5bd5abc205b
parentfc7384c7d44650e9caa25a2f57c05ae9fea7d870 (diff)
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 <edorfaus@gmail.com> 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
-rw-r--r--libopkg/opkg_download.c4
1 files changed, 4 insertions, 0 deletions
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);