aboutsummaryrefslogtreecommitdiffstats
path: root/main/apk-tools/info-segfault.patch
blob: 9479fade30da8f5047861c8a9582e784b0102703 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
commit 87420aaf295f58847332ba3aa89691a0259baace
Author: Timo Teras <timo.teras@iki.fi>
Date:   Wed May 5 08:56:06 2010 +0300

    info: fix querying of removed, but referenced packages
    
    Check that package name has packages associated with it before
    dereferencing the pointer. Fixes #345.

diff --git a/src/info.c b/src/info.c
index 7ca486c..d944fca 100644
--- a/src/info.c
+++ b/src/info.c
@@ -283,7 +283,7 @@ static int info_package(struct info_ctx *ctx, struct apk_database *db,
 
 	for (i = 0; i < argc; i++) {
 		name = apk_db_query_name(db, APK_BLOB_STR(argv[i]));
-		if (name == NULL) {
+		if (name == NULL || name->pkgs == NULL) {
 			apk_error("Not found: %s", argv[i]);
 			return 1;
 		}