From: Rick Bird Date: Fri, 25 Mar 2011 19:13:50 +0000 (-0400) Subject: PennMUSH Incorp. 182p3 X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=2a25cedaa03d8d267c241471181ff86792e70439;p=cobramush.git PennMUSH Incorp. 182p3 * Crash bug in buy fixed. Reported by Amy. Patch by Javelin. --- diff --git a/src/rob.c b/src/rob.c index 3e0442a..8ec3eb7 100644 --- a/src/rob.c +++ b/src/rob.c @@ -241,7 +241,7 @@ void do_buy(dbref player, char *item, char *from, int price) { dbref vendor; - char *prices; + char prices[BUFFER_LEN]; char *plus; char *cost; char finditem[BUFFER_LEN]; @@ -309,10 +309,10 @@ do_buy(dbref player, char *item, char *from, int price) a = atr_get(vendor, "PRICELIST"); if (!a) continue; - /* atr_value uses a static buffer, so we'll take advantage of that */ - prices = atr_value(a); + strncpy(prices,atr_value(a),BUFFER_LEN); + prices[BUFFER_LEN-1] = '\0'; upcasestr(prices); - count = list2arr(r, BUFFER_LEN / 2, atr_value(a), ' '); + count = list2arr(r, BUFFER_LEN / 2, prices, ' '); if (!count) continue; for (i = 0; i < count; i++) {