aboutsummaryrefslogtreecommitdiff
path: root/src/librc/librc-depend.c
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-04 14:01:46 -0500
commit681a37e7bd64a1cdc39613e7ded594dda8e98208 (patch)
tree6798a43f71efbc2f13c549db9055f8367f6cab86 /src/librc/librc-depend.c
parent56d592866c7734c42c0b2c0a41376e299fa3a0c2 (diff)
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>
Diffstat (limited to 'src/librc/librc-depend.c')
-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 ac93716b..c9df4513 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]);