From 681a37e7bd64a1cdc39613e7ded594dda8e98208 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 26 Sep 2013 07:59:29 +0000 Subject: librc: fix off-by-one bug We need allocate space for both the added leading '-' and the trailing '\0'. Signed-off-by: Natanael Copa --- src/librc/librc-depend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/librc/librc-depend.c') 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]); -- cgit v1.2.3