aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <natanael.copa@gmail.com>2013-09-26 08:17:07 +0000
committerWilliam Hubbs <w.d.hubbs@gmail.com>2013-10-04 14:02:02 -0500
commit03c67bcc2727a3e61a168c7dfac98a3dd49c7d79 (patch)
tree63477b004f59a4dd20869ecb8320025df2b1a2a2
parent681a37e7bd64a1cdc39613e7ded594dda8e98208 (diff)
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 <ncopa@alpinelinux.org>
-rw-r--r--src/librc/librc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 839fcd8a..cb4ce63e 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);
}