]> git.mdlowis.com Git - proto/labwc.git/commitdiff
buf.c: fix off by one bug in buf_add_char()
authorJohan Malm <jgm323@gmail.com>
Thu, 7 Nov 2024 21:08:09 +0000 (21:08 +0000)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 7 Nov 2024 22:34:48 +0000 (23:34 +0100)
Written-by: @Consolatis
Fixes: #2313
src/common/buf.c

index 70be9ed0d7d2b1c2fdbdd9d8521a739a8fd6a405..1e103fae22395eccb224b345b38a106553898c6f 100644 (file)
@@ -144,7 +144,7 @@ buf_add(struct buf *s, const char *data)
 void
 buf_add_char(struct buf *s, char ch)
 {
-       buf_expand(s, s->len + 1);
+       buf_expand(s, s->len + 2);
        s->data[s->len++] = ch;
        s->data[s->len] = '\0';
 }