changeset 2892:4f2bae38f077 draft

(svn r3446) - Fix: incorrect validating of tree-planting command which can allow a buffer-overflow (Tron)
author Darkvater <Darkvater@openttd.org>
date Thu, 26 Jan 2006 18:45:04 +0000
parents 69a3fba739d6
children 446b22d5d162
files tree_cmd.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tree_cmd.c
+++ b/tree_cmd.c
@@ -139,7 +139,7 @@
 	int32 cost;
 	int sx, sy, x, y;
 
-	if (p2 > MapSize()) return CMD_ERROR;
+	if (p2 >= MapSize()) return CMD_ERROR;
 	/* Check the tree type. It can be random or some valid value within the current climate */
 	if (p1 != (uint)-1 && p1 - _tree_base_by_landscape[_opt.landscape] >= _tree_count_by_landscape[_opt.landscape]) return CMD_ERROR;