Fix array overstep on invalid PCX error number

This commit is contained in:
Kp 2013-11-30 21:54:17 +00:00
parent c3dd634cce
commit f6125b5f2d

View file

@ -16,6 +16,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#define DXX_WANT_LENGTHOF
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@ -29,6 +30,9 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "palette.h"
#endif
#include "dxxsconf.h"
#include "compiler.h"
static int pcx_encode_byte(ubyte byt, ubyte cnt, PHYSFS_file *fid);
static int pcx_encode_line(ubyte *inBuff, int inLen, PHYSFS_file *fp);
@ -436,7 +440,7 @@ const char *pcx_errormsg(int error_number)
while (error_number--) {
if (!p) return NULL;
if (p == pcx_error_messages + lengthof(pcx_error_messages)) return NULL;
p += strlen(p)+1;