Skip to content

Commit

Permalink
vsnprintf.c: fix printing of a size_t variable
Browse files Browse the repository at this point in the history
printf("%d", <size_t>) is invalid. As this is for legacy compilers,
don't rely on %zu but rather cast to unsigned long long.

Signed-off-by: H. Peter Anvin (Intel) <[email protected]>
  • Loading branch information
H. Peter Anvin (Intel) committed Jul 10, 2020
1 parent 91bc518 commit 2850da7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/vsnprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap)
int rv, bytes;

if (size > BUFFER_SIZE) {
nasm_panic("vsnprintf: size (%d) > BUFFER_SIZE (%d)",
size, BUFFER_SIZE);
nasm_panic("vsnprintf: size (%llu) > BUFFER_SIZE (%d)",
(unsigned long long)size, BUFFER_SIZE);
size = BUFFER_SIZE;
}

Expand Down

0 comments on commit 2850da7

Please sign in to comment.