Skip to content

[Crash] Unchecked roomFound.ready/playerCount/playerLimit in joinGame #72

@coderabbitai

Description

@coderabbitai

Summary

Game server crashes when roomFound object is missing expected properties.

Affected Code

server-game/start-game.js:98-101

if (roomFound) {
  if ((roomFound.ready) && roomFound.playerCount >= roomFound.playerLimit) {
    // CRASH if roomFound.playerCount or roomFound.playerLimit undefined
    ws.close(Comm.Close.gameFull);

Vulnerability

If RoomManager.searchRooms returns incomplete room object.

Impact

  • Game server crash on join attempt
  • Denial of service

Recommended Fix

if (roomFound?.ready && 
    typeof roomFound.playerCount === 'number' && 
    typeof roomFound.playerLimit === 'number' &&
    roomFound.playerCount >= roomFound.playerLimit) {

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions