]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: use bufcopy instead of buf when boundary checking (Thanks thomasba)
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 20 Sep 2011 21:36:23 +0000 (22:36 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 20 Sep 2011 21:36:23 +0000 (22:36 +0100)
Also replace the useless (bufcopy + (next - bufcopy)) with next

src/cfgparse.y

index f1843312dbe6e2f3ed0fec3ce8eb3c51331eb323..dc29860cda021f1f23552ed0bfce8cfaf25aa2d6 100644 (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;