Version v0.2.36 - fixed build warning and corrected encrypt menu output filename generation logic
This commit is contained in:
17
otp.c
17
otp.c
@@ -462,18 +462,11 @@ int handle_encrypt_menu(void) {
|
|||||||
int ascii_armor = (atoi(format_input) == 2) ? 1 : 0;
|
int ascii_armor = (atoi(format_input) == 2) ? 1 : 0;
|
||||||
|
|
||||||
// Generate default output filename and use enhanced input function
|
// Generate default output filename and use enhanced input function
|
||||||
char default_output[512];
|
char default_output[1024]; // Increased size to prevent truncation warnings
|
||||||
snprintf(default_output, sizeof(default_output), "%s.decrypted", input_file);
|
if (ascii_armor) {
|
||||||
|
snprintf(default_output, sizeof(default_output), "%s.otp.asc", input_file);
|
||||||
// Remove common encrypted extensions to get a better default
|
} else {
|
||||||
if (strstr(default_output, ".otp.asc.decrypted")) {
|
snprintf(default_output, sizeof(default_output), "%s.otp", input_file);
|
||||||
// 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 output_file[512];
|
char output_file[512];
|
||||||
|
|||||||
Reference in New Issue
Block a user