mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
risc-v/mpfs: i2c: prevent out of bounds read access
priv->msgid may grow past its boundaries, causing struct i2c_msg_s *msg = &priv->msgv[priv->msgid] to read data out of boundaris. Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
This commit is contained in:
committed by
Xiang Xiao
parent
38f8aae3be
commit
b0cef9e008
@@ -493,7 +493,10 @@ static int mpfs_i2c_irq(int cpuint, void *context, void *arg)
|
||||
|
||||
/* Jump to the next message */
|
||||
|
||||
priv->msgid++;
|
||||
if (priv->msgid < (priv->msgc - 1))
|
||||
{
|
||||
priv->msgid++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -512,7 +515,10 @@ static int mpfs_i2c_irq(int cpuint, void *context, void *arg)
|
||||
|
||||
/* Jump to the next message */
|
||||
|
||||
priv->msgid++;
|
||||
if (priv->msgid < (priv->msgc - 1))
|
||||
{
|
||||
priv->msgid++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user