Fix navigate/march crash on funny path arguments

For an argument consisting of a valid path plus whitespace,
do_unit_move() eventually passed the whitespace suffix to parse(),
then dereferenced player->argp[0].  But that was null.

Broken in commit 0c12d837, v4.3.7.  Trivial for players to trigger.
This commit is contained in:
Markus Armbruster 2010-01-16 17:15:22 +01:00
parent 6c8ba9c3fd
commit 3650587dab

View file

@ -184,7 +184,10 @@ do_unit_move(struct emp_qelem *ulist, int *together,
continue; continue;
} }
ac = parse(cp, scanspace, player->argp, NULL, NULL, NULL); ac = parse(cp, scanspace, player->argp, NULL, NULL, NULL);
if (ac <= 1) { if (ac <= 0) {
player->argp[0] = "";
cp = NULL;
} else if (ac == 1) {
sprintf(dp, "%d", leader->uid); sprintf(dp, "%d", leader->uid);
player->argp[1] = dp; player->argp[1] = dp;
cp++; cp++;