Skip to content

Commit b1e423e

Browse files
committed
ESP: Add a workaround to a "use-of-uninitialized-value"
Found with clang, CFLAGS=-fsanitize=memory. Fix GitHub issues the-tcpdump-group#848 and the-tcpdump-group#849. The problem is that for some unknown reason the pt buffer is not initialized after EVP_DecryptUpdate() call, no error, in: print-esp.c:260: if (!EVP_DecryptUpdate(ctx, pt, &len, ct, ctlen)) { (cherry picked from commit 47a7e20)
1 parent be27282 commit b1e423e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

print-esp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ do_decrypt(netdissect_options *ndo, const char *caller, struct sa_list *sa,
238238
* we can't decrypt on top of the input buffer.
239239
*/
240240
ptlen = ctlen;
241-
pt = (u_char *)malloc(ptlen);
241+
pt = (u_char *)calloc(1, ptlen);
242242
if (pt == NULL) {
243243
EVP_CIPHER_CTX_free(ctx);
244244
(*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,

0 commit comments

Comments
 (0)