[nasm:nasm-2.15.xx] vsnprintf.c: fix printing of a size_t variable

nasm-bot for H. Peter Anvin (Intel) hpa at zytor.com
Thu Jul 9 17:48:04 PDT 2020


Commit-ID:  2850da733d35b4b21aff914f3565ca3d870c9f37
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=2850da733d35b4b21aff914f3565ca3d870c9f37
Author:     H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Thu, 9 Jul 2020 17:44:21 -0700
Committer:  H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Thu, 9 Jul 2020 17:44:21 -0700

vsnprintf.c: fix printing of a size_t variable

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) <hpa at zytor.com>


---
 stdlib/vsnprintf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stdlib/vsnprintf.c b/stdlib/vsnprintf.c
index 284cc194..58de6515 100644
--- a/stdlib/vsnprintf.c
+++ b/stdlib/vsnprintf.c
@@ -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;
     }
 


More information about the Nasm-commits mailing list