]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Fix format-truncation warning, missing string.h inclusion and strnlen warning (#723)
authorFl0-0 <Fl0-0@users.noreply.github.com>
Fri, 30 Nov 2018 08:03:44 +0000 (09:03 +0100)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Fri, 30 Nov 2018 08:03:44 +0000 (09:03 +0100)
* Fix format-truncation warning, missing string.h inclusion and strnlen warning

* Dynamic string width field

client/crypto/asn1dump.c
client/ui.c

index 60799fc8c10dfa14bd4b7fbbed324c2546561008..9570be203b7a59aeee15fbc8242c72cccec44dbe 100644 (file)
@@ -8,11 +8,14 @@
 // asn.1 dumping
 //-----------------------------------------------------------------------------
 
+#define _POSIX_C_SOURCE 200809L                 // need for strnlen()
+
 #include "asn1dump.h"
 #include <ctype.h>
 #include <stdlib.h>
 #include <unistd.h> 
 #include <stdio.h>
+#include <string.h>
 #include <jansson.h>
 #include <mbedtls/asn1.h>
 #include <mbedtls/oid.h>
index 3a1e42c523786b2771f74eb94d08731e4d474dcc..5c9d7424a614189ef5347b2acc8db6600bb4732e 100644 (file)
@@ -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);
        }
 }
Impressum, Datenschutz