aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive/ephyr/XF86dri.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/kdrive/ephyr/XF86dri.c')
-rw-r--r--xorg-server/hw/kdrive/ephyr/XF86dri.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/xorg-server/hw/kdrive/ephyr/XF86dri.c b/xorg-server/hw/kdrive/ephyr/XF86dri.c
index 9d742f394..15b62191f 100644
--- a/xorg-server/hw/kdrive/ephyr/XF86dri.c
+++ b/xorg-server/hw/kdrive/ephyr/XF86dri.c
@@ -64,6 +64,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <GL/glx.h>
#include "xf86dri.h"
#include <X11/dri/xf86driproto.h>
+#include <limits.h>
static XExtensionInfo _xf86dri_info_data;
static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
@@ -225,8 +226,12 @@ XF86DRIOpenConnection(Display * dpy, int screen,
}
if (rep.length) {
- if (!(*busIdString = (char *) calloc(rep.busIdStringLength + 1, 1))) {
- _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
+ if (rep.busIdStringLength < INT_MAX)
+ *busIdString = calloc(rep.busIdStringLength + 1, 1);
+ else
+ *busIdString = NULL;
+ if (*busIdString == NULL) {
+ _XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy);
SyncHandle();
TRACE("OpenConnection... return False");
@@ -323,10 +328,12 @@ XF86DRIGetClientDriverName(Display * dpy, int screen,
*ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
if (rep.length) {
- if (!
- (*clientDriverName =
- (char *) calloc(rep.clientDriverNameLength + 1, 1))) {
- _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
+ if (rep.clientDriverNameLength < INT_MAX)
+ *clientDriverName = calloc(rep.clientDriverNameLength + 1, 1);
+ else
+ *clientDriverName = NULL;
+ if (*clientDriverName == NULL) {
+ _XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy);
SyncHandle();
TRACE("GetClientDriverName... return False");
@@ -532,7 +539,7 @@ XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
SIZEOF(xGenericReply) +
total_rects * sizeof(drm_clip_rect_t)) +
3) & ~3) >> 2)) {
- _XEatData(dpy, rep.length);
+ _XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy);
SyncHandle();
TRACE("GetDrawableInfo... return False");
@@ -606,7 +613,7 @@ XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer,
if (rep.length) {
if (!(*pDevPrivate = (void *) calloc(rep.devPrivateSize, 1))) {
- _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
+ _XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy);
SyncHandle();
TRACE("GetDeviceInfo... return False");