tTwo server input validation bugs fixed: 1. No check was present for paying bac… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit dd4fb7c859062ad35249c6d74147dd76230acfaa | |
parent 373191c7c99d8ef1e29a79e1c41a968896e2b584 | |
Author: Ben Webb <[email protected]> | |
Date: Mon, 22 Apr 2002 09:35:17 +0000 | |
Two server input validation bugs fixed: | |
1. No check was present for paying back a negative amount of money | |
2. Bank or loan shark transactions could be undertaken at any point | |
during the game, in any location | |
Diffstat: | |
M ChangeLog | 3 +++ | |
M src/serverside.c | 6 ++++-- | |
2 files changed, 7 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/ChangeLog b/ChangeLog | |
t@@ -1,4 +1,7 @@ | |
cvs | |
+ - Bug fix: the server will only let you pay back loans or deal with the | |
+ bank when you are at the correct location, and you can no longer | |
+ "pay back" negative amounts of cash to the loan shark | |
- Another dumb PPC bug fixed | |
- Incorrect LIBS generated by configure script in some circumstances | |
(due to a GTK+/Glib bug) - now fixed | |
diff --git a/src/serverside.c b/src/serverside.c | |
t@@ -511,7 +511,8 @@ void HandleServerMessage(gchar *buf, Player *Play) | |
break; | |
case C_DEPOSIT: | |
money = strtoprice(Data); | |
- if (Play->Bank + money >= 0 && Play->Cash - money >= 0) { | |
+ if (Play->EventNum == E_BANK && Play->Bank + money >= 0 | |
+ && Play->Cash - money >= 0) { | |
Play->Bank += money; | |
Play->Cash -= money; | |
SendPlayerData(Play); | |
t@@ -519,7 +520,8 @@ void HandleServerMessage(gchar *buf, Player *Play) | |
break; | |
case C_PAYLOAN: | |
money = strtoprice(Data); | |
- if (Play->Debt - money >= 0 && Play->Cash - money >= 0) { | |
+ if (Play->EventNum == E_LOANSHARK && money > 0 | |
+ && Play->Debt - money >= 0 && Play->Cash - money >= 0) { | |
Play->Debt -= money; | |
Play->Cash -= money; | |
SendPlayerData(Play); |