summaryrefslogtreecommitdiffstats
path: root/main/openrc/0001-librc-fix-off-by-one-bug.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-09-26 08:01:23 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-09-26 08:02:01 +0000
commitbf8eb6a17d6adf8c346744847209506a63bd0c4b (patch)
treeedc64574617641aa5dd32fd517f959f13f0c51f5 /main/openrc/0001-librc-fix-off-by-one-bug.patch
parent7ced03ba3dd23df7ee0f75de2f5f2d226806272a (diff)
downloadaports-bf8eb6a17d6adf8c346744847209506a63bd0c4b.tar.bz2
aports-bf8eb6a17d6adf8c346744847209506a63bd0c4b.tar.xz
main/openrc: fix an off-by-one bug
Diffstat (limited to 'main/openrc/0001-librc-fix-off-by-one-bug.patch')
-rw-r--r--main/openrc/0001-librc-fix-off-by-one-bug.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/main/openrc/0001-librc-fix-off-by-one-bug.patch b/main/openrc/0001-librc-fix-off-by-one-bug.patch
new file mode 100644
index 000000000..96201eac4
--- /dev/null
+++ b/main/openrc/0001-librc-fix-off-by-one-bug.patch
@@ -0,0 +1,29 @@
+From 08cde40ee9abe9d3659133dfa9b10f609a13db20 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 26 Sep 2013 07:58:12 +0000
+Subject: [PATCH] librc: fix off-by-one bug
+
+We need allocate space for both the added leading '-' and the trailing
+'\0'.
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ src/librc/librc-depend.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
+index ac93716..c9df451 100644
+--- a/src/librc/librc-depend.c
++++ b/src/librc/librc-depend.c
+@@ -856,7 +856,7 @@ rc_deptree_update(void)
+ * work for them. This doesn't stop them from being run directly. */
+ if (sys) {
+ len = strlen(sys);
+- nosys = xmalloc(len + 1);
++ nosys = xmalloc(len + 2);
+ nosys[0] = '-';
+ for (i = 0; i < len; i++)
+ nosys[i + 1] = (char)tolower((unsigned char)sys[i]);
+--
+1.8.4
+