Skip to content

Commit 978756a

Browse files
author
Fabrice Bellard
committedMar 20, 2025
protect against printf errors (#319)
1 parent 9936606 commit 978756a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎cutils.c

+2
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ int __attribute__((format(printf, 2, 3))) dbuf_printf(DynBuf *s,
176176
va_start(ap, fmt);
177177
len = vsnprintf(buf, sizeof(buf), fmt, ap);
178178
va_end(ap);
179+
if (len < 0)
180+
return -1;
179181
if (len < sizeof(buf)) {
180182
/* fast case */
181183
return dbuf_put(s, (uint8_t *)buf, len);

0 commit comments

Comments
 (0)