From a5a8296892441bf43553f294bcdbc54b428b621f Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Sun, 27 May 2012 18:28:15 +0200 Subject: [PATCH] Fix clang 3.1 compile warning in crypto.c (Tweaked by nickm) --- changes/bug5969 | 4 ++++ src/common/crypto.c | 11 ++++------- 2 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 changes/bug5969 diff --git a/changes/bug5969 b/changes/bug5969 new file mode 100644 index 0000000000..477d3ddc1a --- /dev/null +++ b/changes/bug5969 @@ -0,0 +1,4 @@ + o Minor bugfixes: + - Fix a compile warning in crypto.c when compiling with clang 3.1. + Fixes bug 5969, bugfix on 0.2.3.9-alpha. + diff --git a/src/common/crypto.c b/src/common/crypto.c index f82598fab2..8feac95acf 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -1806,7 +1806,6 @@ crypto_get_stored_dynamic_dh_modulus(const char *fname) char *contents = NULL; const char *contents_tmp = NULL; int dh_codes; - char *fname_new = NULL; DH *stored_dh = NULL; BIGNUM *dynamic_dh_modulus = NULL; int length = 0; @@ -1881,12 +1880,10 @@ crypto_get_stored_dynamic_dh_modulus(const char *fname) err: - { /* move broken prime to $filename.broken */ - fname_new = tor_malloc(strlen(fname) + 8); - - /* no can do if these functions return error */ - strlcpy(fname_new, fname, strlen(fname) + 8); - strlcat(fname_new, ".broken", strlen(fname) + 8); + { + /* move broken prime to $filename.broken */ + char *fname_new=NULL; + tor_asprintf(&fname_new, "%s.broken", fname); log_warn(LD_CRYPTO, "Moving broken dynamic DH prime to '%s'.", fname_new);