lbm: Don't overflow static colormap buffer.
authorRyan C. Gordon
Wed, 24 Jan 2018 12:00:24 -0500
changeset 557bfa08dc02b3c
parent 556 97f7f01e0665
child 558 a1e9b624ca10
lbm: Don't overflow static colormap buffer.
IMG_lbm.c
     1.1 --- a/IMG_lbm.c	Wed Jan 24 01:45:04 2018 -0500
     1.2 +++ b/IMG_lbm.c	Wed Jan 24 12:00:24 2018 -0500
     1.3 @@ -183,6 +183,11 @@
     1.4  
     1.5          if ( !SDL_memcmp( id, "CMAP", 4 ) ) /* palette ( Color Map ) */
     1.6          {
     1.7 +            if (size > sizeof (colormap)) {
     1.8 +                error="colormap size is too large";
     1.9 +                goto done;
    1.10 +            }
    1.11 +
    1.12              if ( !SDL_RWread( src, &colormap, size, 1 ) )
    1.13              {
    1.14                  error="error reading CMAP chunk";