summaryrefslogtreecommitdiff
path: root/src/encryption.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/encryption.c')
-rw-r--r--src/encryption.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/encryption.c b/src/encryption.c
index 4327506..0bc3d50 100644
--- a/src/encryption.c
+++ b/src/encryption.c
@@ -5,7 +5,6 @@
5*/ 5*/
6 6
7#define _GNU_SOURCE 7#define _GNU_SOURCE
8#define TESTING
9 8
10#include "encryption.h" 9#include "encryption.h"
11#include "ll.h" 10#include "ll.h"
@@ -237,9 +236,15 @@ int ENorDE_cryptvxgg(const struct nodelist *list, const char *passphrase, int fl
237 if(flag == VXGG_DECRYPT) { 236 if(flag == VXGG_DECRYPT) {
238 char *newname = NULL; 237 char *newname = NULL;
239 #ifndef TESTING 238 #ifndef TESTING
240 asprintf(&newname, "%%0.%lds", strlen(p->fullpath) - strlen(".vxgg")); 239 if(asprintf(&newname, "%%0.%lds", strlen(p->fullpath) - strlen(".vxgg")) < 0) {
240 endwin();
241 error(1, errno, "[VX-GAMBLEGROUND] Couldn't get shortened name");
242 }
241 #else 243 #else
242 asprintf(&newname, "%%0.%lds", strlen(p->fullpath) - strlen(".vxgg") - PHRASESIZE - 1); 244 if(asprintf(&newname, "%%0.%lds", strlen(p->fullpath) - strlen(".vxgg") - PHRASESIZE - 1) < 0) {
245 endwin();
246 error(1, errno, "[VX-GAMBLEGROUND] Couldn't get shortened name");
247 }
243 #endif 248 #endif
244 rename_format(p->fullpath, newname, p->fullpath); 249 rename_format(p->fullpath, newname, p->fullpath);
245 free(newname); 250 free(newname);