Skip to content

Commit

Permalink
lev_comp: Show error when map height exceeds temp buffer size
Browse files Browse the repository at this point in the history
Before, it would just segfault.  Now, it shows an informative message,
then segfaults, which still isn't great but is better than nothing.

Incidentally, I hit this when porting the new Ranger quest map from
dNetHack, since it has # comments within the MAP-ENDMAP segment that
would cause the map reader to freak out; I moved them outside for the
port.
  • Loading branch information
tung committed Sep 11, 2015
1 parent 4ca1006 commit 4e5e701
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libnitrohack/util/lev_main.c
Expand Up @@ -874,6 +874,8 @@ void scan_map(char *map, sp_lev *sp)

/* Then parse it now */
while (map && *map) {
if (max_hig >= ROWNO)
lc_error("Map too tall, max is %d", ROWNO);
tmpmap[max_hig] = malloc(max_len);
s1 = strchr(map, '\n');
if (s1) {
Expand Down

0 comments on commit 4e5e701

Please sign in to comment.