]> git.sur5r.net Git - i3/i3/blobdiff - src/cfgparse.y
Bugfix: use bufcopy instead of buf when boundary checking (Thanks thomasba)
[i3/i3] / src / cfgparse.y
index f8e84ae9b3b8eeaf1f4fe707d27b9229a229c42d..dc29860cda021f1f23552ed0bfce8cfaf25aa2d6 100644 (file)
@@ -390,7 +390,8 @@ void parse_file(const char *f) {
         int extra = (strlen(current->value) - strlen(current->key));
         char *next;
         for (next = bufcopy;
-             (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;