From: Fl0-0 Date: Fri, 30 Nov 2018 08:03:44 +0000 (+0100) Subject: Fix format-truncation warning, missing string.h inclusion and strnlen warning (#723) X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/994f21fe017fd0f2373399ff7cfb9843bfd303df Fix format-truncation warning, missing string.h inclusion and strnlen warning (#723) * Fix format-truncation warning, missing string.h inclusion and strnlen warning * Dynamic string width field --- diff --git a/client/crypto/asn1dump.c b/client/crypto/asn1dump.c index 60799fc8..9570be20 100644 --- a/client/crypto/asn1dump.c +++ b/client/crypto/asn1dump.c @@ -8,11 +8,14 @@ // asn.1 dumping //----------------------------------------------------------------------------- +#define _POSIX_C_SOURCE 200809L // need for strnlen() + #include "asn1dump.h" #include #include #include #include +#include #include #include #include diff --git a/client/ui.c b/client/ui.c index 3a1e42c5..5c9d7424 100644 --- a/client/ui.c +++ b/client/ui.c @@ -99,7 +99,7 @@ void PrintAndLogEx(logLevel_t level, char *fmt, ...) { } PrintAndLog(buffer2); } else { - snprintf(buffer2, sizeof(buffer2), "%s%s", prefix, buffer); + snprintf(buffer2, sizeof(buffer2), "%s%.*s", prefix, MAX_PRINT_BUFFER - 20, buffer); PrintAndLog(buffer2); } }