commit 3f0b11a78c37a0460c368f5284ad4a1e1bf154d6
parent 35e5d520b1f20b07261ce537047c4aacf24049f8
Author: Claudio Alessi <smoppy@gmail.com>
Date: Thu, 21 Apr 2022 22:59:12 +0200
Larger buffer size in bprintf()
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/circo.c b/circo.c
@@ -253,14 +253,14 @@ attach(Buffer *b) {
int
bprintf(Buffer *b, char *fmt, ...) {
va_list ap;
- char buf[256 + 80]; /* 80 should be enough for the timestring... */
time_t tm;
+ char buf[512];
int len = 0;
tm = time(NULL);
- len = strftime(buf, sizeof(buf), TIMESTAMP_FORMAT, localtime(&tm));
+ len = strftime(buf, sizeof buf, TIMESTAMP_FORMAT, localtime(&tm));
va_start(ap, fmt);
- vsnprintfc(&buf[len], sizeof(buf) - len - 1, fmt, ap);
+ vsnprintfc(&buf[len], sizeof buf - len - 1, fmt, ap);
len += strlen(&buf[len]);
va_end(ap);
if(!b->size || b->len + len >= b->size)