mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
drivers/eeprom: I2C EEPROM Read/Write Kernel Operations Cause a Device Crash
If user passes NULL as buffer, the driver may crash. This is problematic for NuttX protected and kernel builds. Details in the issue: https://github.com/apache/nuttx/issues/19473 While this fixes the issue with a typical NULL pointer, fundamentally this will be addressed with the implementation of access_ok(). https://man7.org/linux/man-pages/man2/access.2.html Signed-off-by: Catalin Visinescu <catalin_visinescu@yahoo.com>
This commit is contained in:
parent
522ae4cb3f
commit
17fad61ec4
1 changed files with 1 additions and 3 deletions
|
|
@ -178,15 +178,13 @@ ssize_t file_readv(FAR struct file *filep,
|
|||
|
||||
/* Are all iov_base accessible? */
|
||||
|
||||
#if !defined(CONFIG_BUILD_KERNEL) || CONFIG_ARCH_TEXT_VBASE != 0
|
||||
for (ret = 0; ret < iovcnt; ret++)
|
||||
{
|
||||
if (iov[ret].iov_base == NULL && iov[ret].iov_len != 0)
|
||||
if (iov[ret].iov_base == NULL)
|
||||
{
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = -EBADF;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue