fs/mqueue/mq_open.c: Add the judgment for mq_attr is NULL.

Signed-off-by: yangjiao <yangjiao@xiaomi.com>
This commit is contained in:
yangjiao 2023-06-13 22:02:47 +08:00 committed by Xiang Xiao
parent bef756c004
commit a543950951
1 changed files with 6 additions and 3 deletions

View File

@ -191,12 +191,15 @@ static int file_mq_vopen(FAR struct file *mq, FAR const char *mq_name,
mode = va_arg(ap, mode_t);
attr = va_arg(ap, FAR struct mq_attr *);
if (attr != NULL)
{
if (attr->mq_maxmsg <= 0 || attr->mq_msgsize <= 0)
{
ret = -EINVAL;
goto errout;
}
}
}
mode &= ~umask;