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:
parent
6c8ba9c3fd
commit
3650587dab
1 changed files with 4 additions and 1 deletions
|
@ -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++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue