From b51457594740d0f4baa9264edc9eff2ad36b3d5b Mon Sep 17 00:00:00 2001 From: peter1138 Date: Thu, 20 Apr 2006 05:57:47 +0000 Subject: (svn r4481) - Fix: Validate the given sprite ID when loading a sprite. --- spritecache.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spritecache.c') diff --git a/spritecache.c b/spritecache.c index 555304f77..8e99a34f4 100644 --- a/spritecache.c +++ b/spritecache.c @@ -149,6 +149,10 @@ bool LoadNextSprite(int load_index, byte file_index) if (!ReadSpriteHeaderSkipData()) return false; + if (load_index >= MAX_SPRITES) { + error("Tried to load too many sprites (#%d; max %d)", load_index, MAX_SPRITES); + } + _sprite_file_pos[load_index] = file_pos; _sprite_ptr[load_index] = NULL; -- cgit v1.2.3-54-g00ecf