Skip to content

Commit

Permalink
Also check lobbies length in TimeoutPeer store method.
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbollen committed Sep 6, 2023
1 parent 8c2b172 commit 6c28610
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/signaling/stores/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,18 @@ func (s *PostgresStore) ListLobbies(ctx context.Context, game, filter string) ([
}

func (s *PostgresStore) TimeoutPeer(ctx context.Context, peerID, secret, gameID string, lobbies []string) error {

if len(peerID) > 20 {
logger := logging.GetLogger(ctx)
logger.Warn("peer id too long", zap.String("peerID", peerID))
return ErrInvalidPeerID
}
for _, lobby := range lobbies {
if len(lobby) > 20 {
logger := logging.GetLogger(ctx)
logger.Warn("lobby code too long", zap.String("lobbyCode", lobby))
return ErrInvalidLobbyCode
}
}

now := util.Now(ctx)
_, err := s.DB.Exec(ctx, `
Expand Down

0 comments on commit 6c28610

Please sign in to comment.