[pacman-dev] [PATCH 2/2] lib/libalpm/dload.c: Add ASSERT() to alpm_fetch_pkgurl()

Lukas Fleischer archlinux at cryptocrack.de
Thu Aug 18 03:42:21 EDT 2011


Return with ALPM_ERR_WRONG_ARGS instead of causing a potential segfault
if alpm_fetch_pkgurl() is invoked with a NULL URL.

Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
 lib/libalpm/dload.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index a1b6364..0e1c64b 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -450,6 +450,7 @@ char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url)
 	int ret;
 
 	CHECK_HANDLE(handle, return NULL);
+	ASSERT(url, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
 
 	/* find a valid cache dir to download to */
 	cachedir = _alpm_filecache_setup(handle);
-- 
1.7.6



More information about the pacman-dev mailing list