aboutsummaryrefslogtreecommitdiffstats
path: root/main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch')
-rw-r--r--main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch b/main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch
new file mode 100644
index 0000000000..2a84fd1c99
--- /dev/null
+++ b/main/apk-tools/0002-blob-fix-segfault-on-x86_64-with-virtual.patch
@@ -0,0 +1,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
+