mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-25 11:42:10 +01:00
gdir: Add trailing nul delimiter to FILENAME_MAX
`FILENAME_MAX` is not guaranteed to include a trailing nul delimiter, so explicitly add one. See https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html: `PATH_MAX` is explicitly defined to include a nul delimiter; `FILENAME_MAX` is not. See also https://twitter.com/pid_eins/status/1357008940886818822. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
496135c569
commit
3131a6149e
@ -60,7 +60,9 @@ struct _GDir
|
||||
DIR *dirp;
|
||||
#endif
|
||||
#ifdef G_OS_WIN32
|
||||
gchar utf8_buf[FILENAME_MAX*4];
|
||||
/* maximum encoding of FILENAME_MAX UTF-8 characters, plus a nul terminator
|
||||
* (FILENAME_MAX is not guaranteed to include one) */
|
||||
gchar utf8_buf[FILENAME_MAX*4 + 1];
|
||||
#endif
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user