]> granicus.if.org Git - esp-idf/commitdiff
example: Fix a truncation warning
authorAnton Maklakov <anton@espressif.com>
Sun, 11 Nov 2018 05:48:34 +0000 (13:48 +0800)
committerAnton Maklakov <anton@espressif.com>
Thu, 13 Dec 2018 04:29:27 +0000 (12:29 +0800)
examples/wifi/simple_sniffer/main/cmd_sniffer.c

index fb5aea630f3c005bebdb69c6ef3c9dd7e1a4283c..fdf7572c94c1aeccfe85200602cd5af7946ff17e 100644 (file)
@@ -43,9 +43,9 @@ typedef struct {
 static esp_err_t create_packet_file(void)
 {
     uint32_t file_no = 0;
-    char filename[PCAP_FILE_NAME_MAX_LEN];
+    char filename[PCAP_FILE_NAME_MAX_LEN + 15];
     do {
-        snprintf(filename, PCAP_FILE_NAME_MAX_LEN, "%s%d.pcap", packet_filepath, file_no);
+        snprintf(filename, sizeof(filename), "%s%d.pcap", packet_filepath, file_no);
         file_no++;
     } while (0 == access(filename, F_OK));
     /* Create file to write, binary format */