This bug was noticed by cypherpunks; fixes bug 2378.
Bugfix on svn commit r110.
+ o Minor bugfixes
+ - Correctly detect failure to allocate an OpenSSL BIO. Fixes bug 2378;
+ found by "cypherpunks". This bug was introduced before the
+ first Tor release, in svn commit r110.
+
o Minor code simplifications and refactorings
- Always treat failure to allocate an RSA key as an unrecoverable
allocation error.
/* Create a read-only memory BIO, backed by the string 's' */
b = BIO_new_mem_buf((char*)s, (int)len);
+ if (!b)
+ return -1;
if (env->key)
RSA_free(env->key);
tor_assert(dest);
b = BIO_new(BIO_s_mem()); /* Create a memory BIO */
+ if (!b)
+ return -1;
/* Now you can treat b as if it were a file. Just use the
* PEM_*_bio_* functions instead of the non-bio variants.
tor_assert(len<INT_MAX);
b = BIO_new(BIO_s_mem()); /* Create a memory BIO */
+ if (!b)
+ return -1;
BIO_write(b, src, (int)len);