Fixed string warnings with gcc 8.1.0.

This commit is contained in:
yellows8 2018-05-09 20:05:15 -04:00
parent 4dcced2805
commit 4cdf427d12
2 changed files with 2 additions and 2 deletions

View File

@ -58,7 +58,7 @@ int main(int argc, char **argv)
if (R_SUCCEEDED(rc)) {
memset(username, 0, sizeof(username));
strncpy(username, profilebase.username, sizeof(profilebase.username));//Even though profilebase.username usually has a NUL-terminator, don't assume it does for safety.
strncpy(username, profilebase.username, sizeof(username)-1);//Even though profilebase.username usually has a NUL-terminator, don't assume it does for safety.
printf("Username: %s\n", username);//Note that the print-console doesn't support UTF-8. The username is UTF-8, so this will only display properly if there isn't any non-ASCII characters. To display it properly, a print method which supports UTF-8 should be used instead.

View File

@ -55,7 +55,7 @@ int main(int argc, char **argv)
if (R_SUCCEEDED(rc)) {
memset(name, 0, sizeof(name));
strncpy(name, langentry->name, sizeof(langentry->name));//Don't assume the nacp string is NUL-terminated for safety.
strncpy(name, langentry->name, sizeof(name)-1);//Don't assume the nacp string is NUL-terminated for safety.
printf("Name: %s\n", name);//Note that the print-console doesn't support UTF-8. The name is UTF-8, so this will only display properly if there isn't any non-ASCII characters. To display it properly, a print method which supports UTF-8 should be used instead.