From: Johan Malm Date: Thu, 7 Nov 2024 21:08:09 +0000 (+0000) Subject: buf.c: fix off by one bug in buf_add_char() X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=7e50c60b003618729554777e61abda6ca935dc4b;p=proto%2Flabwc.git buf.c: fix off by one bug in buf_add_char() Written-by: @Consolatis Fixes: #2313 --- diff --git a/src/common/buf.c b/src/common/buf.c index 70be9ed0..1e103fae 100644 --- a/src/common/buf.c +++ b/src/common/buf.c @@ -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'; }