summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <natanael.copa@gmail.com>2013-09-26 07:59:29 +0000
committerWilliam Hubbs <w.d.hubbs@gmail.com>2013-10-08 12:06:09 -0500
commit5b0f323da983f316dc05e4d3fa73cc75ea0fd0f1 (patch)
tree541d1f1f0d4789b41bd9096b0ea485be410a1c3b
parentd86853538ab38f4bb98a69bde9956c1f15332207 (diff)
downloadopenrc-5b0f323da983f316dc05e4d3fa73cc75ea0fd0f1.tar.gz
openrc-5b0f323da983f316dc05e4d3fa73cc75ea0fd0f1.tar.bz2
openrc-5b0f323da983f316dc05e4d3fa73cc75ea0fd0f1.tar.xz
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>
-rw-r--r--src/librc/librc-depend.c2
1 files changed, 1 insertions, 1 deletions
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]);