mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Merge branch 'canon-fix' into 'main'
glib: fix buffer overflow in g_canonicalize_filename() See merge request GNOME/glib!2451
This commit is contained in:
commit
f0baa136f9
@ -2754,8 +2754,12 @@ g_canonicalize_filename (const gchar *filename,
|
||||
*output = G_DIR_SEPARATOR;
|
||||
|
||||
/* 1 to re-increment after the final decrement above (so that output >= canon),
|
||||
* and 1 to skip the first `/` */
|
||||
output += 2;
|
||||
* and 1 to skip the first `/`. There might not be a first `/` if
|
||||
* the @canon is a Windows `//server/share` style path with no
|
||||
* trailing directories. @after_root will be '\0' in that case. */
|
||||
output++;
|
||||
if (*output == G_DIR_SEPARATOR)
|
||||
output++;
|
||||
|
||||
/* POSIX allows double slashes at the start to mean something special
|
||||
* (as does windows too). So, "//" != "/", but more than two slashes
|
||||
|
Loading…
Reference in New Issue
Block a user