Skip to content

Commit

Permalink
Check for non-zero buffer size in xSnprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
BenBE committed Aug 13, 2024
1 parent 78acd63 commit bb7a922
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions XUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ int xAsprintf(char** strp, const char* fmt, ...) {
}

int xSnprintf(char* buf, size_t len, const char* fmt, ...) {
assert(len > 0);

va_list vl;
va_start(vl, fmt);
int n = vsnprintf(buf, len, fmt, vl);
Expand Down

0 comments on commit bb7a922

Please sign in to comment.