crypto: unsigned value can't be negative

Reviewed-By: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
Brian White 2014-09-02 09:27:33 -04:00 committed by Fedor Indutny
parent 16b0a3393e
commit fcfe820481

View File

@ -3688,7 +3688,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
String::Utf8Value passphrase(args[3]); String::Utf8Value passphrase(args[3]);
unsigned char* out_value = NULL; 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>( bool r = Cipher<operation, EVP_PKEY_cipher_init, EVP_PKEY_cipher>(
kbuf, kbuf,
@ -3700,7 +3700,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
&out_value, &out_value,
&out_len); &out_len);
if (out_len <= 0 || !r) { if (out_len == 0 || !r) {
delete[] out_value; delete[] out_value;
out_value = NULL; out_value = NULL;
out_len = 0; out_len = 0;