crypto: unsigned value can't be negative
authorBrian White <mscdex@mscdex.net>
Tue, 2 Sep 2014 13:27:33 +0000 (09:27 -0400)
committerFedor Indutny <fedor@indutny.com>
Tue, 2 Sep 2014 13:41:30 +0000 (17:41 +0400)
Reviewed-By: Fedor Indutny <fedor@indutny.com>
src/node_crypto.cc

index 329ca9c..1b72d72 100644 (file)
@@ -3688,7 +3688,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
   String::Utf8Value passphrase(args[3]);
 
   unsigned char* out_value = NULL;
-  size_t out_len = -1;
+  size_t out_len = 0;
 
   bool r = Cipher<operation, EVP_PKEY_cipher_init, EVP_PKEY_cipher>(
       kbuf,
@@ -3700,7 +3700,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
       &out_value,
       &out_len);
 
-  if (out_len <= 0 || !r) {
+  if (out_len == 0 || !r) {
     delete[] out_value;
     out_value = NULL;
     out_len = 0;