diff options
author | Natanael Copa <natanael.copa@gmail.com> | 2013-09-26 08:17:07 +0000 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2013-10-08 12:06:09 -0500 |
commit | d86853538ab38f4bb98a69bde9956c1f15332207 (patch) | |
tree | 095c436c384df6be24f221de065b64c6dc6ebce9 | |
parent | f2c0e700c6fd874a4ef58f79b72b437e8e375e67 (diff) | |
download | openrc-d86853538ab38f4bb98a69bde9956c1f15332207.tar.gz openrc-d86853538ab38f4bb98a69bde9956c1f15332207.tar.bz2 openrc-d86853538ab38f4bb98a69bde9956c1f15332207.tar.xz |
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.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c index 40b975a..28f63f3 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); } |