1 |
commit: 681a37e7bd64a1cdc39613e7ded594dda8e98208 |
2 |
Author: Natanael Copa <natanael.copa <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Sep 26 07:59:29 2013 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 4 19:01:46 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=681a37e7 |
7 |
|
8 |
librc: fix off-by-one bug |
9 |
|
10 |
We need allocate space for both the added leading '-' and the trailing |
11 |
'\0'. |
12 |
|
13 |
Signed-off-by: Natanael Copa <ncopa <AT> alpinelinux.org> |
14 |
|
15 |
--- |
16 |
src/librc/librc-depend.c | 2 +- |
17 |
1 file changed, 1 insertion(+), 1 deletion(-) |
18 |
|
19 |
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c |
20 |
index ac93716..c9df451 100644 |
21 |
--- a/src/librc/librc-depend.c |
22 |
+++ b/src/librc/librc-depend.c |
23 |
@@ -856,7 +856,7 @@ rc_deptree_update(void) |
24 |
* work for them. This doesn't stop them from being run directly. */ |
25 |
if (sys) { |
26 |
len = strlen(sys); |
27 |
- nosys = xmalloc(len + 1); |
28 |
+ nosys = xmalloc(len + 2); |
29 |
nosys[0] = '-'; |
30 |
for (i = 0; i < len; i++) |
31 |
nosys[i + 1] = (char)tolower((unsigned char)sys[i]); |