]> git.sur5r.net Git - i3/i3/commitdiff
A bit more boundary-checking when replacing variables.
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 20 Sep 2011 20:42:26 +0000 (21:42 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 20 Sep 2011 20:42:26 +0000 (21:42 +0100)
Makes valgrind happy

src/cfgparse.y

index f8e84ae9b3b8eeaf1f4fe707d27b9229a229c42d..f1843312dbe6e2f3ed0fec3ce8eb3c51331eb323 100644 (file)
@@ -390,6 +390,7 @@ 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 += strlen(current->key)) {
             *next = '_';