Skip to content

Commit bb7a922

Browse files
committed
Check for non-zero buffer size in xSnprintf
1 parent 78acd63 commit bb7a922

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

XUtils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ int xAsprintf(char** strp, const char* fmt, ...) {
238238
}
239239

240240
int xSnprintf(char* buf, size_t len, const char* fmt, ...) {
241+
assert(len > 0);
242+
241243
va_list vl;
242244
va_start(vl, fmt);
243245
int n = vsnprintf(buf, len, fmt, vl);

0 commit comments

Comments
 (0)