don't allow escape characters in names

This commit is contained in:
Isaac0-dev 2025-02-21 09:47:52 +10:00
parent d71ef89dbb
commit 6ddb7388cc
2 changed files with 7 additions and 1 deletions

View file

@ -749,6 +749,11 @@ NEXT_OPTION:
if (gCLIOpts.playerName[0]) { snprintf(configPlayerName, MAX_CONFIG_STRING, "%s", gCLIOpts.playerName); }
bool djui_panel_player_name_valid(char* buffer);
if (!djui_panel_player_name_valid(configPlayerName)) {
snprintf(configPlayerName, MAX_CONFIG_STRING, "Player");
}
for (int i = 0; i < gCLIOpts.enabledModsCount; i++) {
enable_mod(gCLIOpts.enableMods[i]);
}

View file

@ -327,11 +327,12 @@ static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) {
// player panel //
//////////////////
static bool djui_panel_player_name_valid(char* buffer) {
bool djui_panel_player_name_valid(char* buffer) {
if (buffer[0] == '\0') { return false; }
char* c = buffer;
while (*c != '\0') {
if (*c == ' ') { return false; }
if (*c == '\\') { return false; }
if (!djui_unicode_valid_char(c)) { return false; }
c = djui_unicode_next_char(c);
}