commit 65fac0f3482d89a556aff253daa246d1680f073e from: Markus Uhlin date: Sun Apr 26 22:35:04 2026 UTC Check for snprintf() truncation commit - 7b9d6a23121bd43936e1bd73095abe9b261e7a37 commit + 65fac0f3482d89a556aff253daa246d1680f073e blob - 25ab4f1b1debc0ed91bd937183657e22b81802d7 blob + 8b632622721f5e006fff7969e641190a76e9c29c --- FICS/fics_addplayer.c +++ FICS/fics_addplayer.c @@ -104,8 +104,7 @@ main(int argc, char *argv[]) char password[PASSLEN + 1] = { '\0' }; char salt[FICS_SALT_SIZE] = { '\0' }; char text[2048] = { '\0' }; - int i; - int p; + int i, p, ret; for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { @@ -200,7 +199,7 @@ main(int argc, char *argv[]) "the changes to take effect.\n"); } - snprintf(text, sizeof text, + ret = snprintf(text, sizeof text, "\nYour player account has been created.\n\n" "Login Name: %s\n" "Full Name: %s\n" @@ -225,6 +224,9 @@ main(int argc, char *argv[]) "Regards,\n\nThe FICS admins\n", funame, fname, email, password, settings_get("server_hostname")); + if (is_too_long(ret, sizeof text)) + warnx("mail text truncated (ret: %d)", ret); + mail_string_to_address(email, "FICS Account Created", text); explicit_bzero(password, sizeof(password)); explicit_bzero(text, sizeof(text));