Skip to content

Commit

Permalink
src/info: Add guard to sprnames
Browse files Browse the repository at this point in the history
Part of the code relies on the last entry to be 0 to
know the length of the array ...

Signed-off-by: Sylvain Munaut <[email protected]>
  • Loading branch information
smunaut committed Jan 16, 2021
1 parent fb0fc72 commit 82a7bfc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ rcsid[] = "$Id: info.c,v 1.3 1997/01/26 07:45:00 b1 Exp $";

#include "p_mobj.h"

char *sprnames[NUMSPRITES] = {
char *sprnames[NUMSPRITES+1] = {
"TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG",
"MISF","SAWG","PLSG","PLSF","BFGG","BFGF","BLUD","PUFF","BAL1","BAL2",
"PLSS","PLSE","MISL","BFS1","BFE1","BFE2","TFOG","IFOG","PLAY","POSS",
Expand All @@ -53,7 +53,8 @@ char *sprnames[NUMSPRITES] = {
"POL3","POL1","POL6","GOR2","GOR3","GOR4","GOR5","SMIT","COL1","COL2",
"COL3","COL4","CAND","CBRA","COL6","TRE1","TRE2","ELEC","CEYE","FSKU",
"COL5","TBLU","TGRN","TRED","SMBT","SMGT","SMRT","HDB1","HDB2","HDB3",
"HDB4","HDB5","HDB6","POB1","POB2","BRS1","TLMP","TLP2"
"HDB4","HDB5","HDB6","POB1","POB2","BRS1","TLMP","TLP2",
0
};


Expand Down
2 changes: 1 addition & 1 deletion src/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ typedef struct
} state_t;

extern state_t states[NUMSTATES];
extern char *sprnames[NUMSPRITES];
extern char *sprnames[NUMSPRITES+1];



Expand Down

0 comments on commit 82a7bfc

Please sign in to comment.