tls: stop NodeBIO::Gets from reading off end of buffer
authorMaxwell Krohn <themax@gmail.com>
Tue, 25 Feb 2014 20:48:31 +0000 (15:48 -0500)
committerFedor Indutny <fedor.indutny@gmail.com>
Wed, 26 Feb 2014 13:33:10 +0000 (17:33 +0400)
commita22a2d8656419586647ca1aa6c5008f3e9045424
tree2695894a4870378008cf3927a275de79944ab1c5
parentb5f9779c2f837eb500cd9ead37d88b2717c5ba91
tls: stop NodeBIO::Gets from reading off end of buffer

NodeBIO::Gets was reading off the end of a buffer if it
didn't find a "\n" before the EOF.  This behavior
was causing X509 certificates passed to `https.Agent`
via the "ca" option to be silently discarded. It also
was causing improper parsing of certs and keys
passed to https.Agent, but those problems were worked
around in cdde9a3.

Backed out workaround in `lib/crypto.js` from ccde9a3,
which now isn't needed.  But keep the test introduced
in that commit, which tests properly for this
bug.

This bug was first introduced in a58f93f

Gist containing test code, bisection log, and notes:
   https://gist.github.com/maxtaco/9211605
lib/crypto.js
src/node_crypto_bio.cc