Code

utils strbuf: Don't copy more than needed in sdb_strbuf_skip().
authorSebastian Harl <sh@tokkee.org>
Wed, 23 Apr 2014 21:39:58 +0000 (23:39 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 23 Apr 2014 21:39:58 +0000 (23:39 +0200)
src/utils/strbuf.c

index ee419b7ea20994efaeeaac3d6ae1d246c402dcb0..822f01928c4437b40bb4d621f905cf0b649cea6a 100644 (file)
@@ -306,7 +306,7 @@ sdb_strbuf_skip(sdb_strbuf_t *strbuf, size_t offset, size_t n)
        assert(offset < strbuf->pos);
 
        start = strbuf->string + offset;
-       memmove(start, start + n, strbuf->pos - n);
+       memmove(start, start + n, len - n);
        strbuf->pos -= n;
        strbuf->string[strbuf->pos] = '\0';
 } /* sdb_strbuf_skip */