From: Fabrice Bellard Date: Thu, 20 Mar 2025 10:47:07 +0000 (+0100) Subject: protect against printf errors (#319) X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=978756ad37ecf36201fe6f94a6773d2406b9b276;p=quickjs.git protect against printf errors (#319) --- diff --git a/cutils.c b/cutils.c index c0aacef..c038cf4 100644 --- a/cutils.c +++ b/cutils.c @@ -176,6 +176,8 @@ int __attribute__((format(printf, 2, 3))) dbuf_printf(DynBuf *s, va_start(ap, fmt); len = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); + if (len < 0) + return -1; if (len < sizeof(buf)) { /* fast case */ return dbuf_put(s, (uint8_t *)buf, len);