commit 940ffc20b8332f19f3974bf258018306afdbd421 (patch)
parent 5b80f02b53cc54efb609a956a15151ffd48381e3
Author: Alex Karle <alex@karle.co>
Date: Fri, 3 Apr 2020 23:13:18 -0400
Euchre::Dealer: Validate seat number from client
Bad things happen if you take a seat > 3. Assumptions were made...
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/Euchre/Dealer.pm b/lib/Euchre/Dealer.pm
@@ -154,6 +154,11 @@ sub take_seat {
my $game = $p->{game};
my $seat = $msg->{seat};
+ if ($seat > 3 || $seat < 0) {
+ send_error($p, 'Invalid seat');
+ return;
+ }
+
if (defined $game->{players}->[$seat]) {
send_error($p, 'Seat is taken');
} else {