Merge branch 'maint-0.2.5' into release-0.2.5

This commit is contained in:
Nick Mathewson 2017-02-07 08:41:33 -05:00
commit 2393e67b2e
4 changed files with 26 additions and 0 deletions

6
changes/bug17404 Normal file
View File

@ -0,0 +1,6 @@
o Major bugfixes (security, correctness):
- Fix a programming error that could cause us to read 4 bytes before
the beginning of an openssl string. This could be used to provoke
a crash on systems with an unusual malloc implementation, or
systems with unsual hardening installed. Fixes bug 17404; bugfix
on 0.2.3.6-alpha.

6
changes/bug18089 Normal file
View File

@ -0,0 +1,6 @@
o Minor fixes (security):
- Make memwipe() do nothing when passed a NULL pointer
or zero size. Check size argument to memwipe() for underflow.
Closes bug #18089. Reported by "gk", patch by "teor".
Bugfix on 0.2.3.25 and 0.2.4.6-alpha (#7352),
commit 49dd5ef3 on 7 Nov 2012.

View File

@ -3056,6 +3056,7 @@ secret_to_key(char *key_out, size_t key_out_len, const char *secret,
/**
* Destroy the <b>sz</b> bytes of data stored at <b>mem</b>, setting them to
* the value <b>byte</b>.
* If <b>mem</b> is NULL or <b>sz</b> is zero, nothing happens.
*
* This function is preferable to memset, since many compilers will happily
* optimize out memset() when they can convince themselves that the data being
@ -3073,6 +3074,15 @@ secret_to_key(char *key_out, size_t key_out_len, const char *secret,
void
memwipe(void *mem, uint8_t byte, size_t sz)
{
if (sz == 0) {
return;
}
/* If sz is nonzero, then mem must not be NULL. */
tor_assert(mem != NULL);
/* Data this large is likely to be an underflow. */
tor_assert(sz < SIZE_T_CEILING);
/* Because whole-program-optimization exists, we may not be able to just
* have this function call "memset". A smart compiler could inline it, then
* eliminate dead memsets, and declare itself to be clever. */

View File

@ -2708,6 +2708,10 @@ dn_indicates_v3_cert(X509_NAME *name)
len = ASN1_STRING_to_UTF8(&s, str);
if (len < 0)
return 0;
if (len < 4) {
OPENSSL_free(s);
return 1;
}
r = fast_memneq(s + len - 4, ".net", 4);
OPENSSL_free(s);
return r;