summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-04-15 00:08:05 +0200
committer/dev/humancontroller <devhc@example.com>2017-04-15 17:24:17 +0200
commitdeafddcb7521cdebf7850b0f3a86f1993fcdbc28 (patch)
tree41248b1720b95617f7b2b924e0278c862d73c428
parentc1eb4bccd27fddce7d60d1c51437d7ea91b9d222 (diff)
add boundary checks in BG_ParseCSVBuildableList()
for protection against malicious map files
-rw-r--r--src/game/bg_misc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 0ebcc55..b7f23f3 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -5437,6 +5437,9 @@ void BG_ParseCSVBuildableList( const char *string, buildable_t *buildables, int
while( *p != '\0' )
{
+ if( i == buildablesSize - 1 )
+ break;
+
//skip to first , or EOS
while( *p != ',' && *p != '\0' )
p++;