1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

Properly handle shm_open validation. Fixes bug 16274.

This commit is contained in:
Ondřej Bílka
2013-12-03 20:16:01 +01:00
parent 34e16df5a1
commit b20de2c3d9
3 changed files with 31 additions and 37 deletions

View File

@ -151,7 +151,7 @@ shm_open (const char *name, int oflag, mode_t mode)
namelen = strlen (name);
/* Validate the filename. */
if (name[0] == '\0' || namelen > NAME_MAX || strchr (name, '/') == NULL)
if (name[0] == '\0' || namelen > NAME_MAX || strchr (name, '/') != NULL)
{
__set_errno (EINVAL);
return -1;
@ -241,7 +241,7 @@ shm_unlink (const char *name)
namelen = strlen (name);
/* Validate the filename. */
if (name[0] == '\0' || namelen > NAME_MAX || strchr (name, '/') == NULL)
if (name[0] == '\0' || namelen > NAME_MAX || strchr (name, '/') != NULL)
{
__set_errno (ENOENT);
return -1;