Fixed a free-without-malloc security issue (of art_n.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1291 c06c8d41-db1a-0410-9941-cceddc491573
H7BW6SEIQ57X6V4BM2RX54W42W6BH5XJBAS6FYCYKLQQG43ZMU4QC static inline int random5( int randmax ){return random2(randmax);}
struct unrandart_entry *unrand = seekunrandart( item );return (item_type_known(item) ? unrand->name: unrand->unid_name);
const struct unrandart_entry *unrand = seekunrandart( item );return (item_type_known(item) ? unrand->name : unrand->unid_name);
struct unrandart_entry *unrand = seekunrandart( item );return (item_type_known(item) ? unrand->name: unrand->unid_name);}free(art_n);art_n = (char *) malloc(sizeof(char) * 80);if (art_n == NULL){return ("Malloc Failed Error");
const struct unrandart_entry *unrand = seekunrandart( item );return (item_type_known(item) ? unrand->name : unrand->unid_name);
void standard_name_weap(unsigned char item_typ, char glorg[ITEMNAME_SIZE]){strcpy(glorg, (item_typ == WPN_CLUB) ? "club" :(item_typ == WPN_MACE) ? "mace" :(item_typ == WPN_FLAIL) ? "flail" :(item_typ == WPN_KNIFE) ? "knife" :(item_typ == WPN_DAGGER) ? "dagger" :(item_typ == WPN_MORNINGSTAR) ? "morningstar" :(item_typ == WPN_SHORT_SWORD) ? "short sword" :(item_typ == WPN_LONG_SWORD) ? "long sword" :(item_typ == WPN_GREAT_SWORD) ? "great sword" :(item_typ == WPN_SCIMITAR) ? "scimitar" :(item_typ == WPN_HAND_AXE) ? "hand axe" :(item_typ == WPN_BATTLEAXE) ? "battleaxe" :(item_typ == WPN_SPEAR) ? "spear" :(item_typ == WPN_TRIDENT) ? "trident" :(item_typ == WPN_HALBERD) ? "halberd" :(item_typ == WPN_SLING) ? "sling" :(item_typ == WPN_BOW) ? "bow" :(item_typ == WPN_LONGBOW) ? "longbow" :(item_typ == WPN_BLOWGUN) ? "blowgun" :(item_typ == WPN_CROSSBOW) ? "crossbow" :(item_typ == WPN_HAND_CROSSBOW) ? "hand crossbow" :(item_typ == WPN_GLAIVE) ? "glaive" :(item_typ == WPN_QUARTERSTAFF) ? "quarterstaff" :(item_typ == WPN_SCYTHE) ? "scythe" :(item_typ == WPN_EVENINGSTAR) ? "eveningstar" :(item_typ == WPN_QUICK_BLADE) ? "quick blade" :(item_typ == WPN_KATANA) ? "katana" :(item_typ == WPN_LAJATANG) ? "lajatang" :(item_typ == WPN_EXECUTIONERS_AXE) ? "executioner's axe" :(item_typ == WPN_DOUBLE_SWORD) ? "double sword" :(item_typ == WPN_TRIPLE_SWORD) ? "triple sword" :(item_typ == WPN_HAMMER) ? "hammer" :(item_typ == WPN_ANCUS) ? "ancus" :(item_typ == WPN_WHIP) ? "whip" :(item_typ == WPN_SABRE) ? "sabre" :(item_typ == WPN_DEMON_BLADE) ? "demon blade" :(item_typ == WPN_BLESSED_BLADE)? "blessed blade" :(item_typ == WPN_LOCHABER_AXE) ? "lochaber axe" :(item_typ == WPN_DEMON_WHIP) ? "demon whip" :(item_typ == WPN_DEMON_TRIDENT) ? "demon trident" :(item_typ == WPN_BROAD_AXE) ? "broad axe" :(item_typ == WPN_WAR_AXE) ? "war axe" :(item_typ == WPN_SPIKED_FLAIL) ? "spiked flail" :(item_typ == WPN_GREAT_MACE) ? "great mace" :(item_typ == WPN_DIRE_FLAIL) ? "dire flail" :(item_typ == WPN_FALCHION) ? "falchion" :(item_typ == WPN_GIANT_CLUB)? (SysEnv.board_with_nail ? "two-by-four": "giant club") :(item_typ == WPN_GIANT_SPIKED_CLUB)? (SysEnv.board_with_nail ? "board with nail": "giant spiked club"): "unknown weapon");} // end standard_name_weap()
const char* item_base_name(object_class_type basetype, unsigned char subtype){switch (basetype){case OBJ_WEAPONS:return Weapon_prop[Weapon_index[subtype]].name;case OBJ_ARMOUR:return Armour_prop[Armour_index[subtype]].name;case OBJ_MISSILES:return Missile_prop[Missile_index[subtype]].name;default:return "";}}