diff --git a/otp.c b/otp.c index e42332a..717afb9 100644 --- a/otp.c +++ b/otp.c @@ -462,18 +462,11 @@ int handle_encrypt_menu(void) { int ascii_armor = (atoi(format_input) == 2) ? 1 : 0; // Generate default output filename and use enhanced input function - char default_output[512]; - snprintf(default_output, sizeof(default_output), "%s.decrypted", input_file); - - // Remove common encrypted extensions to get a better default - if (strstr(default_output, ".otp.asc.decrypted")) { - // Replace .otp.asc.decrypted with original extension or no extension - char* ext_pos = strstr(default_output, ".otp.asc.decrypted"); - *ext_pos = '\0'; - } else if (strstr(default_output, ".otp.decrypted")) { - // Replace .otp.decrypted with original extension or no extension - char* ext_pos = strstr(default_output, ".otp.decrypted"); - *ext_pos = '\0'; + char default_output[1024]; // Increased size to prevent truncation warnings + if (ascii_armor) { + snprintf(default_output, sizeof(default_output), "%s.otp.asc", input_file); + } else { + snprintf(default_output, sizeof(default_output), "%s.otp", input_file); } char output_file[512];