Skip to content

Commit

Permalink
Bug #486 CVE-2018-17974 realloc memory if packet size increases
Browse files Browse the repository at this point in the history
Also added check for packet size > cap len, although this may
be never be hit since #484
  • Loading branch information
fklassen committed Oct 18, 2018
1 parent 510aff9 commit 9062a91
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
10/18/2018 Version 4.3.0 beta2
- CVE-2018-17974 heap-buffer-overflow dlt_en10mb_encode (#486)
- CVE-2018-17582 heap-buffer-overflow in get_next_packet (#484)
- CVE-2018-13112 heap-buffer-overflow in get_l2len (#477 dup #408)

01/18/2018 Version 4.3.0 beta1
- Travis CI build fails due to new build images (#432)
Expand Down Expand Up @@ -54,7 +56,7 @@
- Packet destortion --fuzz-seed option by Gabriel Ganne (#302)
- Add --unique-ip-loops option to modify IPs every few loops (#296)
- Netmap startup delay increase (#290)
- tcpcapinfo buffer overflow vulnerablily (#278)
- CVE-2017-6429 tcpcapinfo buffer overflow vulnerablily (#278)
- Update git-clone instructions by Kyle McDonald (#277)
- Allow fractions for --pps option (#270)
- Print per-loop stats with --stats=0 (#269)
Expand Down
13 changes: 12 additions & 1 deletion src/tcpedit/plugins/dlt_en10mb/en10mb.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,20 @@ dlt_en10mb_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, tcpr_dir_t dir)
return TCPEDIT_ERROR;
}

if (pktlen < ctx->l2len) {
tcpedit_seterr(ctx->tcpedit,
"Unable to process packet #" COUNTER_SPEC " since its new length less then %d Layer 2 bytes.",
ctx->tcpedit->runtime.packetnum, ctx->l2len);
return TCPEDIT_ERROR;
}

/* Make space for our new L2 header */
if (newl2len != ctx->l2len)
if (newl2len != ctx->l2len) {
if (newl2len > ctx->l2len)
packet = safe_realloc(packet, pktlen + (newl2len - ctx->l2len));

memmove(packet + newl2len, packet + ctx->l2len, pktlen - ctx->l2len);
}

/* update the total packet length */
pktlen += newl2len - ctx->l2len;
Expand Down

0 comments on commit 9062a91

Please sign in to comment.