Skip to content

Commit 029c941

Browse files
authored
Merge pull request #7897 from thess/localhost-debug-fix
Fix web-editor debug on non-standard port using localhost (CORS)
2 parents d078bc3 + ccbb6a5 commit 029c941

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

supervisor/shared/web_workflow/web_workflow.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,12 @@ static bool _origin_ok(_request *request) {
478478
return true;
479479
}
480480
// DEBUG: OK if origin is 'localhost' (ignoring port #)
481-
*strchrnul(&request->origin[PREFIX_HTTP_LEN], ':') = '\0';
481+
char *cptr = strchrnul(&request->origin[PREFIX_HTTP_LEN], ':');
482+
char csave = *cptr; // NULL or colon
483+
*cptr = '\0';
482484
if (strcmp(&request->origin[PREFIX_HTTP_LEN], "localhost") == 0) {
485+
// Restore removed colon if non-null host terminator
486+
*cptr = csave;
483487
return true;
484488
}
485489
}

0 commit comments

Comments
 (0)