diff options
author | Willem Jan Palenstijn | 2006-05-25 15:06:55 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2006-05-25 15:06:55 +0000 |
commit | a3c50b5f678a4df47354040ebb69f4ad2dd30b5f (patch) | |
tree | a51330f9b4a2e6f44f4fe5ab9eedd50e7fd76e91 /engines/agi | |
parent | b07798783c9bc8c8b1e906cf6043193c00192edc (diff) | |
download | scummvm-rg350-a3c50b5f678a4df47354040ebb69f4ad2dd30b5f.tar.gz scummvm-rg350-a3c50b5f678a4df47354040ebb69f4ad2dd30b5f.tar.bz2 scummvm-rg350-a3c50b5f678a4df47354040ebb69f4ad2dd30b5f.zip |
fix out-of-bounds array access
svn-id: r22627
Diffstat (limited to 'engines/agi')
-rw-r--r-- | engines/agi/id.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/engines/agi/id.cpp b/engines/agi/id.cpp index 4320864a75..c41d6e7227 100644 --- a/engines/agi/id.cpp +++ b/engines/agi/id.cpp @@ -242,11 +242,12 @@ uint32 match_crc(uint32 crc, char *name, int len) { if (c) *c = 0; - /* Remove spaces at end of line */ + /* Remove spaces/tabs at end of line */ if (strlen(buf)) { - for (c = buf + strlen(buf) - 1; - *c == ' ' || *c == '\t'; *c-- = 0) { - } + int i; + for (i = strlen(buf) - 1; + i >= 0 && (buf[i] == ' ' || buf[i] == '\t'); + buf[i--] = 0) { } } t = strtok(buf, " \t\r\n"); |