Flagged six FileX APIs as deprecated (#95)

Added #pragma message compile-time warnings and updated DESCRIPTION
blocks in:
  - fx_directory_long_name_get      -> use _extended (buffer size)
  - fx_directory_short_name_get     -> use _extended (buffer size)
  - fx_media_volume_get             -> use _extended (buffer size)
  - fx_unicode_length_get           -> use _extended (buffer size)
  - fx_unicode_name_get             -> use _extended (buffer size)
  - fx_unicode_short_name_get       -> use _extended (buffer size)

All six functions omit a destination buffer length parameter and use a
fixed or hardcoded limit, which can cause buffer overruns in the caller.
The corresponding _extended variants accept an explicit buffer size and
must be used instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Frédéric Desbiens
2026-07-28 11:06:42 -04:00
committed by GitHub
co-authored by Copilot
parent b3c653c0c5
commit 3a17b07bf5
6 changed files with 78 additions and 6 deletions
+13 -1
View File
@@ -29,6 +29,17 @@
#include "fx_directory.h" #include "fx_directory.h"
/* DEPRECATION NOTICE
* fx_directory_long_name_get() is deprecated. Do not use it in new code.
*
* WHY: Does not accept a destination buffer length; writes up to FX_MAX_LONG_NAME_LEN bytes regardless of the caller's buffer size, risking a buffer overrun.
*
* WHAT TO DO: replace calls with fx_directory_long_name_get_extended(), passing the actual
* destination buffer size as an additional argument.
*/
#pragma message("fx_directory_long_name_get() is deprecated. " \
"Use fx_directory_long_name_get_extended() and pass the actual buffer size.")
/**************************************************************************/ /**************************************************************************/
/* */ /* */
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
@@ -45,7 +56,8 @@
/* name. If there is no long file name, the short file name will be */ /* name. If there is no long file name, the short file name will be */
/* returned. */ /* returned. */
/* */ /* */
/* Note, this API is deprecated as fx_directory_long_name_get_extended */ /* DEPRECATED. Use fx_directory_long_name_get_extended() instead, passing the actual
destination buffer length. Does not accept a destination buffer length; writes up to FX_MAX_LONG_NAME_LEN bytes regardless of the caller's buffer size, risking a buffer overrun.
/* should be used. The maximum written size to long_file_name could be */ /* should be used. The maximum written size to long_file_name could be */
/* FX_MAX_LONG_NAME_LEN. */ /* FX_MAX_LONG_NAME_LEN. */
/* */ /* */
+13 -1
View File
@@ -29,6 +29,17 @@
#include "fx_directory.h" #include "fx_directory.h"
/* DEPRECATION NOTICE
* fx_directory_short_name_get() is deprecated. Do not use it in new code.
*
* WHY: Does not accept a destination buffer length; writes up to FX_MAX_SHORT_NAME_LEN bytes regardless of the caller's buffer size, risking a buffer overrun.
*
* WHAT TO DO: replace calls with fx_directory_short_name_get_extended(), passing the actual
* destination buffer size as an additional argument.
*/
#pragma message("fx_directory_short_name_get() is deprecated. " \
"Use fx_directory_short_name_get_extended() and pass the actual buffer size.")
/**************************************************************************/ /**************************************************************************/
/* */ /* */
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
@@ -45,7 +56,8 @@
/* name. If the long file name is really a short file name, the short */ /* name. If the long file name is really a short file name, the short */
/* file name will be returned. */ /* file name will be returned. */
/* */ /* */
/* Note, this API is deprecated as fx_directory_short_name_get_extended*/ /* DEPRECATED. Use fx_directory_short_name_get_extended() instead, passing the actual
destination buffer length. Does not accept a destination buffer length; writes up to FX_MAX_SHORT_NAME_LEN bytes regardless of the caller's buffer size, risking a buffer overrun.
/* should be used. The maximum written size to short_file_name could */ /* should be used. The maximum written size to short_file_name could */
/* be FX_MAX_SHORT_NAME_LEN. */ /* be FX_MAX_SHORT_NAME_LEN. */
/* */ /* */
+13 -1
View File
@@ -32,6 +32,17 @@
#include "fx_utility.h" #include "fx_utility.h"
/* DEPRECATION NOTICE
* fx_media_volume_get() is deprecated. Do not use it in new code.
*
* WHY: Does not accept a volume-name buffer length; writes up to 12 bytes regardless of the caller's buffer size, risking a buffer overrun.
*
* WHAT TO DO: replace calls with fx_media_volume_get_extended(), passing the actual
* destination buffer size as an additional argument.
*/
#pragma message("fx_media_volume_get() is deprecated. " \
"Use fx_media_volume_get_extended() and pass the actual buffer size.")
/**************************************************************************/ /**************************************************************************/
/* */ /* */
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
@@ -47,7 +58,8 @@
/* This function reads the volume name stored in the media's boot */ /* This function reads the volume name stored in the media's boot */
/* record or root directory. */ /* record or root directory. */
/* */ /* */
/* Note, this API is deprecated as fx_media_volume_get_extended should */ /* DEPRECATED. Use fx_media_volume_get_extended() instead, passing the actual
destination buffer length. Does not accept a volume-name buffer length; writes up to 12 bytes regardless of the caller's buffer size, risking a buffer overrun.
/* be used. The maximum written size to volume_name could be 12. */ /* be used. The maximum written size to volume_name could be 12. */
/* */ /* */
/* INPUT */ /* INPUT */
+13 -1
View File
@@ -29,6 +29,17 @@
#include "fx_unicode.h" #include "fx_unicode.h"
/* DEPRECATION NOTICE
* fx_unicode_length_get() is deprecated. Do not use it in new code.
*
* WHY: Does not accept a buffer length; scans up to 256 bytes regardless of the actual buffer size, risking an overread.
*
* WHAT TO DO: replace calls with fx_unicode_length_get_extended(), passing the actual
* destination buffer size as an additional argument.
*/
#pragma message("fx_unicode_length_get() is deprecated. " \
"Use fx_unicode_length_get_extended() and pass the actual buffer size.")
/**************************************************************************/ /**************************************************************************/
/* */ /* */
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
@@ -43,7 +54,8 @@
/* */ /* */
/* This function returns the length of the supplied unicode name. */ /* This function returns the length of the supplied unicode name. */
/* */ /* */
/* Note, this API is deprecated as _fx_unicode_length_get_extended */ /* DEPRECATED. Use fx_unicode_length_get_extended() instead, passing the actual
destination buffer length. Does not accept a buffer length; scans up to 256 bytes regardless of the actual buffer size, risking an overread.
/* should be used. The maximum buffer size of unicode_name is 256. */ /* should be used. The maximum buffer size of unicode_name is 256. */
/* */ /* */
/* INPUT */ /* INPUT */
+13 -1
View File
@@ -29,6 +29,17 @@
#include "fx_unicode.h" #include "fx_unicode.h"
/* DEPRECATION NOTICE
* fx_unicode_name_get() is deprecated. Do not use it in new code.
*
* WHY: Does not accept a destination buffer length; writes up to FX_MAX_LONG_NAME_LEN*2 bytes regardless of the caller's buffer size, risking a buffer overrun.
*
* WHAT TO DO: replace calls with fx_unicode_name_get_extended(), passing the actual
* destination buffer size as an additional argument.
*/
#pragma message("fx_unicode_name_get() is deprecated. " \
"Use fx_unicode_name_get_extended() and pass the actual buffer size.")
/**************************************************************************/ /**************************************************************************/
/* */ /* */
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
@@ -44,7 +55,8 @@
/* This function finds the unicode name associated with the supplied */ /* This function finds the unicode name associated with the supplied */
/* short 8.3 name. */ /* short 8.3 name. */
/* */ /* */
/* Note, this API is deprecated as fx_unicode_name_get_extended should */ /* DEPRECATED. Use fx_unicode_name_get_extended() instead, passing the actual
destination buffer length. Does not accept a destination buffer length; writes up to FX_MAX_LONG_NAME_LEN*2 bytes regardless of the caller's buffer size, risking a buffer overrun.
/* be used. The maximum written size to destination_unicode_name could */ /* be used. The maximum written size to destination_unicode_name could */
/* be FX_MAX_LONG_NAME_LEN * 2. */ /* be FX_MAX_LONG_NAME_LEN * 2. */
/* */ /* */
+13 -1
View File
@@ -29,6 +29,17 @@
#include "fx_unicode.h" #include "fx_unicode.h"
/* DEPRECATION NOTICE
* fx_unicode_short_name_get() is deprecated. Do not use it in new code.
*
* WHY: Does not accept a destination buffer length; writes up to 13 bytes regardless of the caller's buffer size, risking a buffer overrun.
*
* WHAT TO DO: replace calls with fx_unicode_short_name_get_extended(), passing the actual
* destination buffer size as an additional argument.
*/
#pragma message("fx_unicode_short_name_get() is deprecated. " \
"Use fx_unicode_short_name_get_extended() and pass the actual buffer size.")
/**************************************************************************/ /**************************************************************************/
/* */ /* */
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
@@ -44,7 +55,8 @@
/* This function finds the short name associated with the supplied */ /* This function finds the short name associated with the supplied */
/* unicode name. */ /* unicode name. */
/* */ /* */
/* Note, this API is deprecated as fx_unicode_short_name_get_extended */ /* DEPRECATED. Use fx_unicode_short_name_get_extended() instead, passing the actual
destination buffer length. Does not accept a destination buffer length; writes up to 13 bytes regardless of the caller's buffer size, risking a buffer overrun.
/* should be used. The maximum written size to destination_short_name */ /* should be used. The maximum written size to destination_short_name */
/* could be 13. */ /* could be 13. */
/* */ /* */