aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2006-05-25 15:06:55 +0000
committerWillem Jan Palenstijn2006-05-25 15:06:55 +0000
commita3c50b5f678a4df47354040ebb69f4ad2dd30b5f (patch)
treea51330f9b4a2e6f44f4fe5ab9eedd50e7fd76e91 /engines/agi
parentb07798783c9bc8c8b1e906cf6043193c00192edc (diff)
downloadscummvm-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.cpp9
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");