[Mesa-dev] [PATCH mesa 2/5] egl: take new string into account when checking for overflow
Tapani Pälli
tapani.palli at intel.com
Thu Mar 2 06:51:19 UTC 2017
Maybe squash this together with patch 1?
On 03/02/2017 01:31 AM, Eric Engestrom wrote:
> Otherwise the check would detect that the previous append() resulted in
> a buffer overflow, which would not even be caught if the last extension
> in the string is the one that goes over (which is likely).
>
> Signed-off-by: Eric Engestrom <eric at engestrom.ch>
> ---
> src/egl/main/eglapi.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index d964b4d289..220e53be8c 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -470,7 +470,8 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
> #define _EGL_CHECK_EXTENSION(ext) \
> do { \
> if (dpy->Extensions.ext) { \
> - assert(exts <= dpy->ExtensionsString + _EGL_MAX_EXTENSIONS_LEN); \
> + assert(exts + strlen("EGL_" #ext) <= \
> + dpy->ExtensionsString + _EGL_MAX_EXTENSIONS_LEN); \
> _eglAppendExtension(&exts, "EGL_" #ext); \
> } \
> } while (0)
>
More information about the mesa-dev
mailing list