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>
This commit is contained in:
parent
681a37e7bd
commit
03c67bcc27
@ -193,7 +193,7 @@ file_regex(const char *file, const char *regex)
|
|||||||
str += strlen(str) + 1;
|
str += strlen(str) + 1;
|
||||||
/* len is the size of allocated buffer and we don't
|
/* len is the size of allocated buffer and we don't
|
||||||
want call regexec BUFSIZE times. find next str */
|
want call regexec BUFSIZE times. find next str */
|
||||||
while (*str == '\0' && str < line + len)
|
while (str < line + len && *str == '\0')
|
||||||
str++;
|
str++;
|
||||||
} while (str < line + len);
|
} while (str < line + len);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user