Attached Files |
0001-Fix-crash-editting-a-duration-in-wiz-mode.patch [^] (1,238 bytes) 2014-06-15 06:49 [Show Content] [Hide Content]From ac74fc255f1e316a2ce8d0a51b93ba7b9d529832 Mon Sep 17 00:00:00 2001
From: Aj <aj.k.adamson@gmail.com>
Date: Sat, 14 Jun 2014 22:45:00 -0600
Subject: [PATCH] Fix crash editting a duration in wiz mode.
---
crawl-ref/source/wiz-you.cc | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc
index eb1db10..63fc9fe 100644
--- a/crawl-ref/source/wiz-you.cc
+++ b/crawl-ref/source/wiz-you.cc
@@ -758,13 +758,13 @@ void wizard_edit_durations()
canned_msg(MSG_OK);
return;
}
-
+
if (!strlcpy(buf, lowercase_string(trimmed_string(buf)).c_str(), sizeof(buf)))
{
canned_msg(MSG_OK);
return;
}
-
+
duration_type choice = NUM_DURATIONS;
if (strlen(buf) == 1 && isalower(buf[0]))
@@ -781,7 +781,12 @@ void wizard_edit_durations()
mprf(MSGCH_PROMPT, "Invalid choice.");
return;
}
- choice = durs[choice];
+ choice = durs[dchoice];
+ if (choice < 0 || choice >= (int) NUM_DURATIONS)
+ {
+ mprf(MSGCH_PROMPT, "Stored duration is invalid.");
+ return;
+ }
}
else
{
--
1.8.3.msysgit.0
|