Skip to content

[Crash] Unchecked mentions[0] array access in whisper chat #60

@coderabbitai

Description

@coderabbitai

Summary

Game server crashes when mentions[0] is undefined in whisper message handling.

Affected Code

server-game/src/client.js:351-353

if (mentions[0]) {
  this.room.packChat(output, text, this.id, Comm.Chat.whisper);
  mentions[0].forEach(player => { // CRASH if mentions is [undefined]

Vulnerability

If mentions[0] is explicitly undefined (array containing undefined), forEach crashes.

Impact

  • Game server crash on whisper
  • Denial of service

Recommended Fix

if (mentions[0] && Array.isArray(mentions[0])) {
  mentions[0].forEach(player => {

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