media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer
PATCH 1/1 media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer
msg is controlled by user. If accessing msg.buf without sanity check, null pointer deref would happen. Although there are some existing checks on msg.len, they do not cover all buffer access points. Therefore, we add an additional check on msg.len to prevent potential crashes.
Similar commit: commit 0ed554fd769a ("media: dvb-usb: az6027:
fix null-ptr-deref in az6027_i2c_xfer()")
Signed-off-by Alex Guo <[email protected]>
--- drivers/media/usb/dvb-usb/az6027.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb/az6027.c +2 -2
@@ -988,7 +988,7 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n/* write/read request */ if (i +1 < num && (msg[i +1 ].flags &I2C_M_RD )) { req =0xB9 ; -if (msg[i].len <1 ) { +if (msg[i].len <2 ) { i = -EOPNOTSUPP ;break ; }
@@ -1005,7 +1005,7 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n/* demod 16bit addr */ req =0xBD ; -if (msg[i].len <1 ) { +if (msg[i].len <2 ) { i = -EOPNOTSUPP ;break ; }
Signature · 1 line
2.34.1