[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r13415: Fix bug in last patch that made secret_to_key crash. (in tor/trunk: . src/common)
Author: nickm
Date: 2008-02-07 11:10:36 -0500 (Thu, 07 Feb 2008)
New Revision: 13415
Modified:
tor/trunk/
tor/trunk/src/common/crypto.c
Log:
r17964@catbus: nickm | 2008-02-07 10:45:02 -0500
Fix bug in last patch that made secret_to_key crash.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r17964] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/common/crypto.c
===================================================================
--- tor/trunk/src/common/crypto.c 2008-02-07 16:10:33 UTC (rev 13414)
+++ tor/trunk/src/common/crypto.c 2008-02-07 16:10:36 UTC (rev 13415)
@@ -2093,7 +2093,7 @@
{
crypto_digest_env_t *d;
uint8_t c;
- size_t count;
+ size_t count, tmplen;
char *tmp;
tor_assert(key_out_len < SIZE_T_CEILING);
@@ -2105,7 +2105,8 @@
tor_assert(key_out_len <= DIGEST_LEN);
d = crypto_new_digest_env();
- tmp = tor_malloc(8+secret_len);
+ tmplen = 8+secret_len;
+ tmp = tor_malloc(tmplen);
memcpy(tmp,s2k_specifier,8);
memcpy(tmp+8,secret,secret_len);
secret_len += 8;
@@ -2119,7 +2120,7 @@
}
}
crypto_digest_get_digest(d, key_out, key_out_len);
- memset(tmp, 0, 8+secret_len);
+ memset(tmp, 0, tmplen);
tor_free(tmp);
crypto_free_digest_env(d);
}