From 2a25cedaa03d8d267c241471181ff86792e70439 Mon Sep 17 00:00:00 2001 From: Rick Bird Date: Fri, 25 Mar 2011 15:13:50 -0400 Subject: [PATCH] PennMUSH Incorp. 182p3 * Crash bug in buy fixed. Reported by Amy. Patch by Javelin. --- src/rob.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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++) { -- 2.30.2