This is an automated email from the ASF dual-hosted git repository.

linguini pushed a commit to branch releases/12.12
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/releases/12.12 by this push:
     new 4782ee93945 bugfix/fs:write Bad buf addr should return EINVAL
4782ee93945 is described below

commit 4782ee939459562af274b8bfb087a430955cbe56
Author: guohao15 <[email protected]>
AuthorDate: Mon Nov 18 15:55:26 2024 +0800

    bugfix/fs:write Bad buf addr should return EINVAL
    
    return EINVAL if iov_base == NULL
    
    Signed-off-by: guohao15 <[email protected]>
---
 fs/vfs/fs_write.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/vfs/fs_write.c b/fs/vfs/fs_write.c
index 8d4cc5da294..168538b569f 100644
--- a/fs/vfs/fs_write.c
+++ b/fs/vfs/fs_write.c
@@ -71,6 +71,11 @@ static ssize_t file_writev_compat(FAR struct file *filep,
           continue;
         }
 
+      if (iov[i].iov_base == NULL)
+        {
+          return -EINVAL;
+        }
+
       /* Sanity check to avoid total length overflow */
 
       if (SSIZE_MAX - ntotal < iov[i].iov_len)

Reply via email to