]> granicus.if.org Git - esp-idf/commitdiff
spiffs: test: check for truncation in snprintf call
authorIvan Grokhotkov <ivan@espressif.com>
Tue, 28 Aug 2018 04:23:27 +0000 (12:23 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Wed, 29 Aug 2018 04:49:15 +0000 (12:49 +0800)
components/spiffs/test/test_spiffs.c

index 60bca410bda629b8b835a4a9a0a98f333808e94d..cb2164ac1f8bb54f93aa9a462a9a01867ef7271b 100644 (file)
@@ -291,7 +291,8 @@ void test_spiffs_readdir_many_files(const char* dir_prefix)
             if (!de) {
                 break;
             }
-            snprintf(file_name, sizeof(file_name), "%s/%s", dir_prefix, de->d_name);
+            int len = snprintf(file_name, sizeof(file_name), "%s/%s", dir_prefix, de->d_name);
+            assert(len < sizeof(file_name));
             unlink(file_name);
         }
     }