From 79c8c4a034c3eb655b4858c299dc12d7f52a807e Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 18 Oct 2014 21:36:46 +0200 Subject: [PATCH 1/4] fix a crash when testing for the RESHOW ANY command. E2 crashed when no parameter was given. --- src/laws.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/laws.c b/src/laws.c index 602adf816..a19fb4dc8 100755 --- a/src/laws.c +++ b/src/laws.c @@ -2586,7 +2586,7 @@ int reshow_cmd(unit * u, struct order *ord) init_order(ord); s = getstrtoken(); - if (isparam(s, u->faction->locale, P_ANY)) { + if (s && isparam(s, u->faction->locale, P_ANY)) { p = getparam(u->faction->locale); s = NULL; } From adcd4ec1c671b09e01fb80f4e1569c7127a1944c Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 18 Oct 2014 21:40:56 +0200 Subject: [PATCH 2/4] increase build number. --- src/build.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build.h b/src/build.h index bb1b13a0c..8559801d0 100644 --- a/src/build.h +++ b/src/build.h @@ -1,3 +1,3 @@ #define VERSION_MAJOR 3 #define VERSION_MINOR 3 -#define VERSION_BUILD 685 +#define VERSION_BUILD 686 From f3e54e103a566e635270b59f3cddf1bdfb94df01 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 25 Oct 2014 23:54:01 +0200 Subject: [PATCH 3/4] fix a crash when selling nothing. build 687 --- src/build.h | 2 +- src/economy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build.h b/src/build.h index 8559801d0..f69bc269f 100644 --- a/src/build.h +++ b/src/build.h @@ -1,3 +1,3 @@ #define VERSION_MAJOR 3 #define VERSION_MINOR 3 -#define VERSION_BUILD 686 +#define VERSION_BUILD 687 diff --git a/src/economy.c b/src/economy.c index 965df6478..7f4bf506c 100644 --- a/src/economy.c +++ b/src/economy.c @@ -2389,7 +2389,7 @@ static bool sell(unit * u, request ** sellorders, struct order *ord) } } else { - n = atoi((const char *)s); + n = s ? atoi(s) : 0; if (n == 0) { cmistake(u, ord, 27, MSG_COMMERCE); return false; From dc7cbd886c84b09f13f9d989d0b73ebc0bd283ba Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 1 Nov 2014 21:57:06 +0100 Subject: [PATCH 4/4] fix the quit command, asserting the wrong keyword (probably copypasta). --- src/build.h | 2 +- src/laws.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build.h b/src/build.h index f69bc269f..7eb5647df 100644 --- a/src/build.h +++ b/src/build.h @@ -1,3 +1,3 @@ #define VERSION_MAJOR 3 #define VERSION_MINOR 3 -#define VERSION_BUILD 687 +#define VERSION_BUILD 688 diff --git a/src/laws.c b/src/laws.c index a19fb4dc8..c7e72bfaf 100755 --- a/src/laws.c +++ b/src/laws.c @@ -926,7 +926,7 @@ int quit_cmd(unit * u, struct order *ord) keyword_t kwd; kwd = init_order(ord); - assert(kwd == K_PASSWORD); + assert(kwd == K_QUIT); passwd = getstrtoken(); if (checkpasswd(f, (const char *)passwd, false)) { if (EnhancedQuit()) {