mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
ncr710: Fix potential null pointer dereference
The code dereferences s->current before checking if it is NULL. Move the null check before the dereference to prevent potential crashes. This issue could occur if s->current is NULL when the function reaches the "Host adapter (re)connected" path, though this should not normally happen during correct operation. Reported-by: Stefan Hajnoczi <stefanha@gmail.com> Reported-by: GuoHan Zhao <zhaoguohan@kylinos.cn> Suggested-by: GuoHan Zhao <zhaoguohan@kylinos.cn> Signed-off-by: Soumyajyotii Ssarkar <soumyajyotisarkar23@gmail.com> Reviewed-by: Helge Deller <deller@gmx.de> Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
committed by
Helge Deller
parent
917ac07f9a
commit
9d1bccac8f
+1
-2
@@ -832,12 +832,11 @@ void ncr710_transfer_data(SCSIRequest *req, uint32_t len)
|
||||
}
|
||||
|
||||
/* Host adapter (re)connected */
|
||||
s->current->dma_len = len;
|
||||
s->command_complete = NCR710_CMD_DATA_READY;
|
||||
|
||||
if (!s->current) {
|
||||
return;
|
||||
}
|
||||
s->current->dma_len = len;
|
||||
|
||||
if (s->waiting) {
|
||||
s->scntl1 |= NCR710_SCNTL1_CON;
|
||||
|
||||
Reference in New Issue
Block a user