fs/vfs: clear filep when call file_open/file_mq_open to avoid random value

fix crash caused by stack random value

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1
2025-06-24 21:38:46 +08:00
committed by Alan C. Assis
parent bdd3869d26
commit e85cdac2ed
2 changed files with 4 additions and 0 deletions

View File

@@ -412,6 +412,8 @@ int file_mq_open(FAR struct file *mq,
va_list ap;
int ret;
memset(mq, 0, sizeof(*mq));
va_start(ap, oflags);
ret = file_mq_vopen(mq, mq_name, oflags, 0, ap, NULL);
va_end(ap);

View File

@@ -366,6 +366,8 @@ int file_open(FAR struct file *filep, FAR const char *path, int oflags, ...)
va_list ap;
int ret;
memset(filep, 0, sizeof(*filep));
va_start(ap, oflags);
ret = file_vopen(filep, path, oflags, 0, ap);
va_end(ap);