tfc_say("convert encrypted data into ASCII format to ease transmission.");
tfc_say("\n");
tfc_say(" -e, -d: encrypt, decrypt (it maybe required).");
- tfc_say(" -L <file>: load tfcrypt defsults from file.");
+ tfc_say(" -L <file>: load tfcrypt defaults from file.");
tfc_say(" defaults is text file which defines salt, nr_turns and default mode.");
tfc_say(" -s <file>: load tfcrypt salt from file.");
tfc_say(" -s disable: disable key salting at all.");
s = (char *)srcblk;
d = getenv("HOME");
if (!d) d = "";
- xstrlcat(s, d, PATH_MAX > sizeof(srcblk) ? sizeof(srcblk) : PATH_MAX);
- xstrlcat(s, "/.tfcrypt.defs", PATH_MAX > sizeof(srcblk) ? sizeof(srcblk) : PATH_MAX);
+ n = PATH_MAX > sizeof(srcblk) ? sizeof(srcblk) : PATH_MAX;
+ if (xstrlcpy(s, d, n) >= n) goto _baddfname;
+ if (xstrlcat(s, "/.tfcrypt.defs", n) >= n) goto _baddfname;
read_defaults(s, YES);
- memset(s, 0, PATH_MAX > sizeof(srcblk) ? sizeof(srcblk) : PATH_MAX);
+_baddfname:
+ memset(s, 0, n);
opterr = 0;
while ((c = getopt(argc, argv, "L:s:aU:C:r:K:t:TPkzxc:l:qedn:vV:pwE:O:S:AmM:R:Z:WHD:")) != -1) {