dix: protect from pScreen->SetCursorPosition == NULL

It's safer not relying on all ScreenProc's actually filled.

../dix/events.c: In function ‘CheckPhysLimits’:
../dix/events.c:780:14: warning: dereference of NULL ‘pScreen’ [CWE-476] [-Wanalyzer-null-dereference]
  780 |             (*pScreen->SetCursorPosition)
      |             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-05-06 14:44:13 +02:00
parent 654c9c1f3d
commit f1ba454733
4 changed files with 12 additions and 6 deletions

View File

@@ -330,7 +330,8 @@ xf86RandRSetConfig(ScreenPtr pScreen,
view_adjusted = TRUE;
}
(*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE);
if (pScreen->SetCursorPosition)
pScreen->SetCursorPosition(dev, pScreen, px, py, FALSE);
}
}

View File

@@ -2393,7 +2393,9 @@ DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
py = pScrn->frameY0;
if (py > pScrn->frameY1)
py = pScrn->frameY1;
pScreen->SetCursorPosition(inputInfo.pointer, pScreen, px, py, TRUE);
if (pScreen->SetCursorPosition)
pScreen->SetCursorPosition(inputInfo.pointer, pScreen, px, py, TRUE);
return;
}