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-26 09:31:14 -03:00
committed by Alan C. Assis
parent bdd3869d26
commit e85cdac2ed
2 changed files with 4 additions and 0 deletions
+2
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);
+2
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);