commit 66bb56ad19043744641960c416040b49f9def6c6
parent f418fec045772c94db459bc9da8c813fb803ee0b
Author: night0721 <[email protected]>
Date: Wed, 10 Apr 2024 17:05:06 +0100
fix extension not removed from basename
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/argon.c b/argon.c
@@ -382,7 +382,12 @@ int main(int argc, char *argv[])
fseek(file, 0, SEEK_SET);
char *content = memalloc(file_size * sizeof(char));
fread(content, sizeof(char), file_size, file);
- encrypt_password(basename(filename), content);
+ char *f_basename = basename(filename);
+ char *dot = strrchr(f_basename, '.');
+ if (dot != NULL) {
+ *dot = '\0';
+ }
+ encrypt_password(f_basename, content);
exit(EXIT_SUCCESS);
break;
case 'G':;