aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2025-11-02 10:52:50 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2025-11-02 10:52:50 +0100
commitcc9aa35050fe4e1e796288327a03b08e5943dbe2 (patch)
tree532a989946ea578a9b7e2e4666173a8d05c8a46a
parent9cc867670d3024d914b2a38e4047afd66abc24d7 (diff)
Added overflow checks
-rw-r--r--FICS/playerdb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index 2b8ef04..21fc66d 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -2072,6 +2072,11 @@ player_decline_offers(int p, int p1, int offerType)
}
while ((offer = player_find_pendfrom(p, p1, offerType)) >= 0) {
+ if (offer >= (int)ARRAY_SIZE(parray[0].p_from_list)) {
+ warnx("%s: 'offer' too large", __func__);
+ break;
+ }
+
type = parray[p].p_from_list[offer].type;
p2 = parray[p].p_from_list[offer].whofrom;
p2Name = parray[p2].name;
@@ -2185,6 +2190,11 @@ player_withdraw_offers(int p, int p1, int offerType)
}
while ((offer = player_find_pendto(p, p1, offerType)) >= 0) {
+ if (offer >= (int)ARRAY_SIZE(parray[0].p_to_list)) {
+ warnx("%s: 'offer' too large", __func__);
+ break;
+ }
+
type = parray[p].p_to_list[offer].type;
p2 = parray[p].p_to_list[offer].whoto;
p2Name = parray[p2].name;