crypto: fix error message buffer overrun
authorBen Noordhuis <info@bnoordhuis.nl>
Fri, 16 Sep 2011 17:16:30 +0000 (19:16 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Fri, 16 Sep 2011 17:16:32 +0000 (19:16 +0200)
ERR_error_string() expects a buffer of at least 256 bytes, the input buffer
was not even half that size. Use ERR_error_string_n() instead.

src/node_crypto.cc

index 5c049bd8305c066d82ecd6567813b278571961b2..bebcbd12c3b2a51387234887d9f64dd01f5a4d10 100644 (file)
@@ -333,7 +333,7 @@ Handle<Value> SecureContext::SetCert(const Arguments& args) {
           String::New("SSL_CTX_use_certificate_chain")));
     }
     char string[120];
-    ERR_error_string(err, string);
+    ERR_error_string_n(err, string, sizeof string);
     return ThrowException(Exception::Error(String::New(string)));
   }