Skip to content

Fix operator precedence in character creation validation#318

Open
kwsantiago wants to merge 1 commit intoOpenFusionProject:masterfrom
kwsantiago:fix/char-creation-validation-precedence
Open

Fix operator precedence in character creation validation#318
kwsantiago wants to merge 1 commit intoOpenFusionProject:masterfrom
kwsantiago:fix/char-creation-validation-precedence

Conversation

@kwsantiago
Copy link

Summary

The parentheses in validateCharacterCreation are misplaced, causing iHeight, iNameCheck, and iSkinColor to never be validated.

The current code:

if (!(... && style->iHairColor <= 18) &&
      style->iHeight    >= 0 && ...
      style->iSkinColor >= 1 && style->iSkinColor <= 12)

The ) closes after iHairColor, so the expression becomes !(A) && B && C && D instead of the intended !(A && B && C && D). This means a client can send arbitrary values for height, name check, and skin color.

What changed

Moved the closing ) to the end of the full condition, matching the intended logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant