ソースを参照

update tinydir.h to newest version (1.2.6)

Update to cxong/tinydir version 1.2.6 commit 8124807 ("Fix buffer overflow in tinydir_file_open with long path names")

Although we're not affected of this bug, prevent others copying from our repo being affected...
Simon Goldschmidt 2 年 前
コミット
09188668c7
1 ファイル変更11 行追加4 行削除
  1. 11 4
      src/apps/http/makefsdata/tinydir.h

+ 11 - 4
src/apps/http/makefsdata/tinydir.h

@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013-2019, tinydir authors:
+Copyright (c) 2013-2021, tinydir authors:
 - Cong Xu
 - Lautis Sun
 - Baudouin Feildel
@@ -125,8 +125,13 @@ extern "C" {
 # define _TINYDIR_FUNC static __inline
 #elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
 # define _TINYDIR_FUNC static __inline__
-#else
+#elif defined(__cplusplus)
 # define _TINYDIR_FUNC static inline
+#elif defined(__GNUC__)
+/* Suppress unused function warning */
+# define _TINYDIR_FUNC __attribute__((unused)) static
+#else
+# define _TINYDIR_FUNC static
 #endif
 
 /* readdir_r usage; define TINYDIR_USE_READDIR_R to use it (if supported) */
@@ -543,7 +548,9 @@ int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file)
 	if (_tstat(
 #elif (defined _BSD_SOURCE) || (defined _DEFAULT_SOURCE)	\
 	|| ((defined _XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500))	\
-	|| ((defined _POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L))
+	|| ((defined _POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)) \
+	|| ((defined __APPLE__) && (defined __MACH__)) \
+	|| (defined BSD)
 	if (lstat(
 #else
 	if (stat(
@@ -636,7 +643,7 @@ int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path)
 	int result = 0;
 	int found = 0;
 	_tinydir_char_t dir_name_buf[_TINYDIR_PATH_MAX];
-	_tinydir_char_t file_name_buf[_TINYDIR_FILENAME_MAX];
+	_tinydir_char_t file_name_buf[_TINYDIR_PATH_MAX];
 	_tinydir_char_t *dir_name;
 	_tinydir_char_t *base_name;
 #if (defined _MSC_VER || defined __MINGW32__)