diff options
-rw-r--r-- | include/X11/ICE/ICEmsg.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/X11/ICE/ICEmsg.h b/include/X11/ICE/ICEmsg.h index 9688e3c..426b64c 100644 --- a/include/X11/ICE/ICEmsg.h +++ b/include/X11/ICE/ICEmsg.h @@ -33,6 +33,11 @@ Author: Ralph Mor, X Consortium #include <X11/ICE/ICEconn.h> +#include <assert.h> +#ifndef static_assert +#define static_assert(cond, msg) /* skip for non-C11 compilers */ +#endif + _XFUNCPROTOBEGIN /* @@ -123,6 +128,8 @@ extern IcePaAuthStatus _IcePaMagicCookie1Proc ( */ #define IceGetHeader(_iceConn, _major, _minor, _headerSize, _msgType, _pMsg) \ + static_assert(_headerSize <= 1024, \ + "Header size larger than ICE_OUTBUFSIZE"); \ if ((_iceConn->outbufptr + _headerSize) > _iceConn->outbufmax) \ IceFlush (_iceConn); \ _pMsg = (_msgType *) _iceConn->outbufptr; \ @@ -133,6 +140,8 @@ extern IcePaAuthStatus _IcePaMagicCookie1Proc ( _iceConn->send_sequence++ #define IceGetHeaderExtra(_iceConn, _major, _minor, _headerSize, _extra, _msgType, _pMsg, _pData) \ + static_assert(_headerSize <= 1024, \ + "Header size larger than ICE_OUTBUFSIZE"); \ if ((_iceConn->outbufptr + \ _headerSize + ((_extra) << 3)) > _iceConn->outbufmax) \ IceFlush (_iceConn); \ |