* we can't decrypt on top of the input buffer.
*/
ptlen = ctlen;
- pt = (u_char *)malloc(ptlen);
+ pt = (u_char *)calloc(1, ptlen);
if (pt == NULL) {
EVP_CIPHER_CTX_free(ctx);
(*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
*/
if (!nd_push_buffer(ndo, pt, pt, ctlen)) {
free(pt);
- return 0;
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: can't push buffer on buffer stack", __func__);
}
return 1;
ND_PRINT(", length %u", length);
#ifdef HAVE_LIBCRYPTO
- /* initiailize SAs */
+ /* initialize SAs */
if (ndo->ndo_sa_list_head == NULL) {
if (!ndo->ndo_espsecret)
return;
* Don't put padding + padding length(1 byte) + next header(1 byte)
* in the buffer because they are not part of the plaintext to decode.
*/
- nd_push_snaplen(ndo, pt, payloadlen - (padlen + 2));
+ if (!nd_push_snaplen(ndo, pt, payloadlen - (padlen + 2))) {
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: can't push snaplen on buffer stack", __func__);
+ }
/* Now dissect the plaintext. */
ip_demux_print(ndo, pt, payloadlen - (padlen + 2), ver, fragmented,