Fix getpath() not to crash when path exceeds MAX_PATH_LEN

Trivial for players to trigger.  Broken in commit 0b0612ea, v4.3.16.
Spotted by the Clang Static Analyzer.
This commit is contained in:
Markus Armbruster 2010-01-14 22:39:42 +01:00
parent 9b62b35424
commit ad80846283

View file

@ -173,7 +173,7 @@ getpath(char *buf, char *arg, coord x, coord y, int onlyown,
if (p + strlen(bp) + 1 >= buf + MAX_PATH_LEN) {
pr("Path length may not exceed %d.\n", MAX_PATH_LEN);
pr("Aborting...\n");
bp = NULL;
return NULL;
}
strcpy(p, bp);
if (*bp)