Merge branch 'maint-0.2.7'

This commit is contained in:
Nick Mathewson 2015-11-30 22:03:00 -05:00
commit ee5337e904
2 changed files with 8 additions and 1 deletions

3
changes/bug17722 Normal file
View File

@ -0,0 +1,3 @@
o Minor bugfixes (code correctness)
- Fix undefined behavior in the tor_cert_checksig function. Fixes bug
17722; bugfix on tor-0.2.7.2-alpha.

View File

@ -206,7 +206,11 @@ tor_cert_checksig(tor_cert_t *cert,
return -1; return -1;
} else { } else {
cert->sig_ok = 1; cert->sig_ok = 1;
memcpy(cert->signing_key.pubkey, checkable.pubkey->pubkey, 32); /* Only copy the checkable public key when it is different from the signing
* key of the certificate to avoid undefined behavior. */
if (cert->signing_key.pubkey != checkable.pubkey->pubkey) {
memcpy(cert->signing_key.pubkey, checkable.pubkey->pubkey, 32);
}
cert->cert_valid = 1; cert->cert_valid = 1;
return 0; return 0;
} }