Replace some size displayed with '%lu' as unsigned long

with proper '%zu' as size_t.
This commit is contained in:
Patrick Pelissier committed 2018-08-02 19:34:10 +02:00
1 parent b01459d1ef
commit 603fb9db62
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -2025,8 +2025,8 @@ m_core_hash (const void *str, size_t length)
#include <stdio.h>
#include <stdlib.h>
#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
+1 -1
View File
@@ -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]);