navigate: Fix buffer overrun for impossibly long paths taken
When a player moves more than 1023 sectors in a single navigate command, we overrun the buffer holding the path taken. Remote hole, but it requires a ship that can go that far, and even a ship with speed 1000 would need a tech level well in excess of 1000 for that. Thus, the hole is purely theoretical for even remotely sane game configurations. First known version with the flaw is 4.0.0. Fix by going back the older behavior: don't print the total path taken, but do print what the path finder does. Context diff of an example: [0:634] Command : nav 3 6,0 Flagship is od oil derrick (#3) +Using path 'n' h = k . . j d <67.2:67.2: 6,0> h od oil derrick (#3) stopped at 6,0 -Path taken: n This is how march works. Removes the only use of shp_nav_one_sector()'s unusual return value 2. Return 1 instead. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
56ac486cc8
commit
a4e519c377
7 changed files with 9 additions and 60 deletions
|
@ -806,7 +806,7 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
|
|||
sprintf(dp, "can't go to %s", xyas(newx, newy, actor));
|
||||
if (together) {
|
||||
mpr(actor, "%s\n", dp);
|
||||
return 2;
|
||||
return 1;
|
||||
} else {
|
||||
shp_stays(actor, dp, mlp);
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue