Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: src/librc/
Date: Fri, 04 Oct 2013 19:07:58
Message-Id: 1380913322.03c67bcc2727a3e61a168c7dfac98a3dd49c7d79.williamh@OpenRC
1 commit: 03c67bcc2727a3e61a168c7dfac98a3dd49c7d79
2 Author: Natanael Copa <natanael.copa <AT> gmail <DOT> com>
3 AuthorDate: Thu Sep 26 08:17:07 2013 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 4 19:02:02 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=03c67bcc
7
8 librc: fix a read off-by-one bug
9
10 We should first check if we are within bounds and then read rather than
11 the opposite.
12
13 This makes valgrind happy.
14
15 Signed-off-by: Natanael Copa <ncopa <AT> alpinelinux.org>
16
17 ---
18 src/librc/librc.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21 diff --git a/src/librc/librc.c b/src/librc/librc.c
22 index 839fcd8..cb4ce63 100644
23 --- a/src/librc/librc.c
24 +++ b/src/librc/librc.c
25 @@ -193,7 +193,7 @@ file_regex(const char *file, const char *regex)
26 str += strlen(str) + 1;
27 /* len is the size of allocated buffer and we don't
28 want call regexec BUFSIZE times. find next str */
29 - while (*str == '\0' && str < line + len)
30 + while (str < line + len && *str == '\0')
31 str++;
32 } while (str < line + len);
33 }