From: Andrey Rys Date: Wed, 20 Mar 2019 11:51:54 +0000 (+0700) Subject: Amend previous commit. X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=26668913a55e867900ae7f80615640d814494e29;p=tfcrypt.git Amend previous commit. --- diff --git a/VERSION b/VERSION index 60d3b2f..b6a7d89 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -15 +16 diff --git a/tfc_error.c b/tfc_error.c index 6e2dabf..001273e 100644 --- a/tfc_error.c +++ b/tfc_error.c @@ -151,7 +151,7 @@ void usage(void) 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 : load tfcrypt defsults from file."); + tfc_say(" -L : load tfcrypt defaults from file."); tfc_say(" defaults is text file which defines salt, nr_turns and default mode."); tfc_say(" -s : load tfcrypt salt from file."); tfc_say(" -s disable: disable key salting at all."); diff --git a/tfcrypt.c b/tfcrypt.c index 2390516..c8664cc 100644 --- a/tfcrypt.c +++ b/tfcrypt.c @@ -65,10 +65,12 @@ int main(int argc, char **argv) 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) {