From 03c67bcc2727a3e61a168c7dfac98a3dd49c7d79 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 26 Sep 2013 08:17:07 +0000 Subject: librc: fix a read off-by-one bug We should first check if we are within bounds and then read rather than the opposite. This makes valgrind happy. Signed-off-by: Natanael Copa --- src/librc/librc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/librc/librc.c b/src/librc/librc.c index 839fcd8..cb4ce63 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -193,7 +193,7 @@ file_regex(const char *file, const char *regex) str += strlen(str) + 1; /* len is the size of allocated buffer and we don't want call regexec BUFSIZE times. find next str */ - while (*str == '\0' && str < line + len) + while (str < line + len && *str == '\0') str++; } while (str < line + len); } -- cgit v1.2.3