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:27:35 +0000 (05:27 -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 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 522522291362a4e3cea93ecd363f022fd2860af0..177f6d736ff8f33b17975fcc8501b1b2545e5b56 100644 (file)
@@ -278,7 +278,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;
     }