aboutsummaryrefslogtreecommitdiffstats
path: root/main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch
blob: 2a84fd1c999a7aae0a3a66dbafb440b84073655c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From c9690b0e7cdb977184e9649cd1bd3688787c1fb5 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 23 Nov 2010 09:18:40 +0000
Subject: [PATCH 2/2] blob: fix segfault on x86_64 with --virtual

blob.ptr might be non-null on empty field in /var/lib/apk/installed
so we compare with blob length.

This fixes a segfault on x86_64.
---
 src/blob.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/blob.c b/src/blob.c
index 83bcf80..70004e6 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -18,7 +18,7 @@ char *apk_blob_cstr(apk_blob_t blob)
 {
 	char *cstr;
 
-	if (blob.ptr == NULL)
+	if (blob.len == 0)
 		return strdup("");
 
 	if (blob.ptr[blob.len-1] == 0)
-- 
1.7.3.2