Bugfix: use bufcopy instead of buf when boundary checking (Thanks thomasba)

Also replace the useless (bufcopy + (next - bufcopy)) with next
This commit is contained in:
Michael Stapelberg 2011-09-20 22:36:23 +01:00
parent cd6c3fedcb
commit 77ae3cd8f7
1 changed files with 2 additions and 2 deletions

View File

@ -390,8 +390,8 @@ void parse_file(const char *f) {
int extra = (strlen(current->value) - strlen(current->key));
char *next;
for (next = bufcopy;
(bufcopy + (next - bufcopy)) < (buf + stbuf.st_size) &&
(next = strcasestr(bufcopy + (next - bufcopy), current->key)) != NULL;
next < (bufcopy + stbuf.st_size) &&
(next = strcasestr(next, current->key)) != NULL;
next += strlen(current->key)) {
*next = '_';
extra_bytes += extra;