From 603fb9db626657ab46065b4bfb89e341f81aa13a Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Thu, 2 Aug 2018 19:34:10 +0200 Subject: [PATCH] Replace some size displayed with '%lu' as unsigned long with proper '%zu' as size_t. --- m-core.h | 4 ++-- m-string.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/m-core.h b/m-core.h index 6b2f0425..366a9edd 100644 --- a/m-core.h +++ b/m-core.h @@ -2025,8 +2025,8 @@ m_core_hash (const void *str, size_t length) #include #include #define M_MEMORY_FULL(size) do { \ - fprintf(stderr, "ERROR(M*LIB): Can not allocate memory in function %s of file %s:%d (%lu bytes).\n", \ - __func__, __FILE__, __LINE__, (unsigned long) size); \ + fprintf(stderr, "ERROR(M*LIB): Can not allocate memory in function %s of file %s:%d (%zu bytes).\n", \ + __func__, __FILE__, __LINE__, (size_t) size); \ abort(); \ } while (0) #endif diff --git a/m-string.h b/m-string.h index cf7b6ad3..84ad0f42 100644 --- a/m-string.h +++ b/m-string.h @@ -706,7 +706,7 @@ string_fget_word (string_t v, const char separator[], FILE *f) The user shall give a constant string as the separator argument, as a control over this argument may give an attacker an opportunity for stack overflow */ - while (snprintf(buffer, sizeof buffer -1, " %%%lu[^%s]%%c", (unsigned long) v->alloc-1-v->size, separator) > 0 + while (snprintf(buffer, sizeof buffer -1, " %%%zu[^%s]%%c", (size_t) v->alloc-1-v->size, separator) > 0 && fscanf(f, buffer, &v->ptr[v->size], &c) == 2) { retcode = true; v->size += strlen(&v->ptr[v->size]);