mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-31 13:24:13 +02:00
Guard against bogus return value from strxfrm(). For instance Microsoft's
2004-08-21 Tor Lillqvist <tml@iki.fi> * glib/gunicollate.c (g_utf8_collate_key): Guard against bogus return value from strxfrm(). For instance Microsoft's strxfrm() returns INT_MAX on errors. (#141124)
This commit is contained in:
committed by
Tor Lillqvist
parent
c61e425b91
commit
e65caea220
@@ -231,6 +231,14 @@ g_utf8_collate_key (const gchar *str,
|
||||
if (str_locale)
|
||||
{
|
||||
xfrm_len = strxfrm (NULL, str_locale, 0);
|
||||
if (xfrm_len < 0 || xfrm_len >= G_MAXINT - 2)
|
||||
{
|
||||
g_free (str_locale);
|
||||
str_locale = NULL;
|
||||
}
|
||||
}
|
||||
if (str_locale)
|
||||
{
|
||||
result = g_malloc (xfrm_len + 2);
|
||||
result[0] = 'A';
|
||||
strxfrm (result + 1, str_locale, xfrm_len + 1);
|
||||
|
Reference in New Issue
Block a user