return 0;
}
- i = (*collector)->length; /* BUF_MEM_grow() changes it! */
- /*
- * The i + datalen check is to distinguish between BUF_MEM_grow()
- * signaling an error and BUF_MEM_grow() simply returning the (zero)
- * length.
- */
- if (!BUF_MEM_grow(*collector, i + datalen)
- && i + datalen != 0)
- return 0;
- if (data != NULL)
+ if (data != NULL && datalen > 0) {
+ i = (*collector)->length; /* BUF_MEM_grow() changes it! */
+
+ if (!BUF_MEM_grow(*collector, i + datalen))
+ return 0;
memcpy((*collector)->data + i, data, datalen);
+ }
return 1;
}
* Perform the semantics described in
* EVP_PKEY_CTX_add1_tls1_prf_seed(3)
*/
- if (ctx->pmeth->pkey_id == NID_tls1_prf)
+ if (ctx->pmeth->pkey_id == NID_tls1_prf) {
BUF_MEM_free(pkctx->collected_seed);
+ pkctx->collected_seed = NULL;
+ }
break;
case EVP_PKEY_CTRL_TLS_SEED:
cmd = T_OCTET_STRING;