# HG changeset patch # User tron # Date 1104790060 0 # Node ID a0849f41e7488fa1f2bbc1fee28b69ecb1c5d688 # Parent d275d6d2aa657d99aa56fe705117f1aae152a572 (svn r1358) Assert bounds of depot list when searching for a depot diff -r d275d6d2aa65 -r a0849f41e748 roadveh_gui.c --- a/roadveh_gui.c Mon Jan 03 22:04:34 2005 +0000 +++ b/roadveh_gui.c Mon Jan 03 22:07:40 2005 +0000 @@ -512,7 +512,9 @@ SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap); /* locate the depot struct */ - for(d=_depots; d->xy != (TileIndex)tile; d++) {} + for (d = _depots; d->xy != (TileIndex)tile; d++) { + assert(d < endof(_depots); + } SetDParam(0, d->town_index); DrawWindowWidgets(w); diff -r d275d6d2aa65 -r a0849f41e748 ship_gui.c --- a/ship_gui.c Mon Jan 03 22:04:34 2005 +0000 +++ b/ship_gui.c Mon Jan 03 22:07:40 2005 +0000 @@ -646,7 +646,9 @@ SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap); /* locate the depot struct */ - for(d=_depots; d->xy != (TileIndex)tile; d++) {} + for (d = _depots; d->xy != (TileIndex)tile; d++) { + assert(d < endof(_depots); + } SetDParam(0, d->town_index); DrawWindowWidgets(w); diff -r d275d6d2aa65 -r a0849f41e748 train_gui.c --- a/train_gui.c Mon Jan 03 22:04:34 2005 +0000 +++ b/train_gui.c Mon Jan 03 22:07:40 2005 +0000 @@ -333,7 +333,9 @@ SetHScrollCount(w, hnum); /* locate the depot struct */ - for(d=_depots; d->xy != (TileIndex)tile; d++) {} + for (d = _depots; d->xy != (TileIndex)tile; d++) { + assert(d < endof(_depots); + } SetDParam(0, d->town_index); DrawWindowWidgets(w);