prevent a couple of reported array index segfaults
Changes to be committed: modified: src/hack.c modified: src/pager.c Don't use glyph_to_cmap as an array index into the defsyms[] array unless it really is a cmap. Recent situation: glyph_to_cmap will return NO_GLYPH for the unknown monster glyph 'I', which is not a valid index for the defsyms[] array.
This commit is contained in:
@@ -1363,7 +1363,7 @@ domove()
|
|||||||
|
|
||||||
if (boulder)
|
if (boulder)
|
||||||
Strcpy(buf, ansimpleoname(boulder));
|
Strcpy(buf, ansimpleoname(boulder));
|
||||||
else if (solid)
|
else if (solid && glyph_is_cmap(glyph))
|
||||||
Strcpy(buf, the(defsyms[glyph_to_cmap(glyph)].explanation));
|
Strcpy(buf, the(defsyms[glyph_to_cmap(glyph)].explanation));
|
||||||
else if (!Underwater)
|
else if (!Underwater)
|
||||||
Strcpy(buf, "thin air");
|
Strcpy(buf, "thin air");
|
||||||
|
|||||||
@@ -273,7 +273,8 @@ lookat(x, y, buf, monbuf)
|
|||||||
Strcpy(buf, Is_airlevel(&u.uz) ? "cloudy area" : "fog/vapor cloud");
|
Strcpy(buf, Is_airlevel(&u.uz) ? "cloudy area" : "fog/vapor cloud");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Strcpy(buf,defsyms[glyph_to_cmap(glyph)].explanation);
|
if (glyph_is_cmap(glyph))
|
||||||
|
Strcpy(buf,defsyms[glyph_to_cmap(glyph)].explanation);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user