Good hygiene with size_t output argument.
authorViktor Dukhovni <openssl-users@dukhovni.org>
Sat, 21 Nov 2015 05:59:07 +0000 (00:59 -0500)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Sat, 21 Nov 2015 10:23:20 +0000 (05:23 -0500)
Though the callers check the function return value and ignore the
size_t output argument on failure, it is still often not ideal to
store -1 in a size_t on error.  That might signal an unduly large
buffer.  Instead set the size_t to 0, to indicate no space.

Reviewed-by: Richard Levitte <levitte@openssl.org>
ssl/s3_cbc.c

index f3aa8781e29c1e32240aab40dc758888f1fa2579..557622f51365d20f284686f87d88877d71f77e81 100644 (file)
@@ -520,7 +520,7 @@ int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
          */
         OPENSSL_assert(0);
         if (md_out_size)
-            *md_out_size = -1;
+            *md_out_size = 0;
         return 0;
     }