Check for string truncation to silence a warning

This commit is contained in:
pstef 2025-04-06 11:18:22 +00:00
parent 7a17ed09ee
commit fbb093255a
1 changed files with 5 additions and 1 deletions

View File

@ -6178,7 +6178,11 @@ bool input_remapping_save_file(const char *path)
if (skip_port)
continue;
snprintf(formatted_number, sizeof(formatted_number), "%u", i + 1);
_len = snprintf(formatted_number, sizeof(formatted_number), "%u", i + 1);
if (_len >= sizeof(formatted_number)) {
RARCH_ERR("[Config]: unexpectedly high number of users");
break;
}
_len = strlcpy(prefix, "input_player", sizeof(prefix));
strlcpy(prefix + _len, formatted_number, sizeof(prefix) - _len);
_len = strlcpy(s1, prefix, sizeof(s1));