X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglx%2FXF86dri.c;h=885ec93db5520486b323f0d0b892492b2ffa1582;hb=3797a82e785a433245a679b5ad3f84f614380c72;hp=b1cdc9b286538aba0fa73c7366cb6b52e7e397e0;hpb=2b7a972e3f36bfcdc6fbe2b59d7ffdcde49c9405;p=mesa.git diff --git a/src/glx/XF86dri.c b/src/glx/XF86dri.c index b1cdc9b2865..885ec93db55 100644 --- a/src/glx/XF86dri.c +++ b/src/glx/XF86dri.c @@ -29,7 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: * Kevin E. Martin - * Jens Owen + * Jens Owen * Rickard E. (Rik) Faith * */ @@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include "xf86dristr.h" +#include static XExtensionInfo _xf86dri_info_data; static XExtensionInfo *xf86dri_info = &_xf86dri_info_data; @@ -201,7 +202,11 @@ XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, } if (rep.length) { - if (!(*busIdString = calloc(rep.busIdStringLength + 1, 1))) { + if (rep.busIdStringLength < INT_MAX) + *busIdString = calloc(rep.busIdStringLength + 1, 1); + else + *busIdString = NULL; + if (*busIdString == NULL) { _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); @@ -300,9 +305,11 @@ XF86DRIGetClientDriverName(Display * dpy, int screen, *ddxDriverPatchVersion = rep.ddxDriverPatchVersion; if (rep.length) { - if (! - (*clientDriverName = - calloc(rep.clientDriverNameLength + 1, 1))) { + if (rep.clientDriverNameLength < INT_MAX) + *clientDriverName = calloc(rep.clientDriverNameLength + 1, 1); + else + *clientDriverName = NULL; + if (*clientDriverName == NULL) { _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); @@ -433,7 +440,7 @@ XF86DRIDestroyDrawable(Display * dpy, int screen, XID drawable) * destroyDrawable(drawable); * * which is a textbook race condition - the window may disappear - * from the server between checking for its existance and + * from the server between checking for its existence and * destroying it. Instead we change the semantics of * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if * the windows is gone, by wrapping the destroy call in an error