(x_basename): fix dereference of null pointer.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2014-04-20 18:30:12 +04:00
parent a6c5c82fa0
commit 8c040b46b8

View File

@ -648,6 +648,9 @@ x_basename (const char *s)
url_delim = g_strrstr (s, VFS_PATH_URL_DELIMITER); url_delim = g_strrstr (s, VFS_PATH_URL_DELIMITER);
path_sep = strrchr (s, PATH_SEP); path_sep = strrchr (s, PATH_SEP);
if (path_sep == NULL)
return s;
if (url_delim == NULL if (url_delim == NULL
|| url_delim < path_sep - strlen (VFS_PATH_URL_DELIMITER) || url_delim < path_sep - strlen (VFS_PATH_URL_DELIMITER)
|| url_delim - s + strlen (VFS_PATH_URL_DELIMITER) < strlen (s)) || url_delim - s + strlen (VFS_PATH_URL_DELIMITER) < strlen (s))