From: Michael Stapelberg Date: Tue, 20 Sep 2011 21:36:23 +0000 (+0100) Subject: Bugfix: use bufcopy instead of buf when boundary checking (Thanks thomasba) X-Git-Tag: 4.1~142^2^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=77ae3cd8f77e4e255e823b07cd8b50d28b38e03b;p=i3%2Fi3 Bugfix: use bufcopy instead of buf when boundary checking (Thanks thomasba) Also replace the useless (bufcopy + (next - bufcopy)) with next --- diff --git a/src/cfgparse.y b/src/cfgparse.y index f1843312..dc29860c 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -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;