Skip to content

Commit

Permalink
Require at least one digit when parsing percentage.
Browse files Browse the repository at this point in the history
  • Loading branch information
skullernet authored and res2k committed Jan 25, 2024
1 parent 264f28a commit b1e7875
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/client/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ static void CL_Seek_f(void)
if (strchr(to, '%')) {
char *suf;
float percent = strtof(to, &suf);
if (strcmp(suf, "%") || !isfinite(percent)) {
if (suf == to || strcmp(suf, "%") || !isfinite(percent)) {
Com_Printf("Invalid percentage.\n");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/mvd/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2255,7 +2255,7 @@ static void MVD_Seek_f(void)
if (strchr(to, '%')) {
char *suf;
float percent = strtof(to, &suf);
if (strcmp(suf, "%") || !isfinite(percent)) {
if (suf == to || strcmp(suf, "%") || !isfinite(percent)) {
Com_Printf("[%s] Invalid percentage.\n", mvd->name);
return;
}
Expand Down

0 comments on commit b1e7875

Please sign in to comment.