Skip to content

Commit

Permalink
Bug appneta#380 exit nicely on invalid fuzz packet size
Browse files Browse the repository at this point in the history
  • Loading branch information
fklassen committed May 5, 2017
1 parent dfe3c4a commit f56d2e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
05/02/2017 Version 4.2.5
- AFL detected security crash in fuzz feature (#380)
- Coverity static scan detected issues (#374)
- Fuzz should not be overwritting Layer 3 (#372)
- Add --fuzz-factor option to specify fuzz ratio (#371)
Expand Down
15 changes: 10 additions & 5 deletions src/tcpedit/fuzzing.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,21 @@ fuzz_get_sgt_size(uint32_t r, uint32_t caplen)

static inline int
fuzz_reduce_packet_size(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr,
COUNTER new_len)
uint32_t new_len)
{
assert(new_len <= pkthdr->len);

if (pkthdr->len < pkthdr->caplen) {
tcpedit_seterr(tcpedit, "%s", "Packet larger than capture len.");
tcpedit_seterr(tcpedit, "Packet length %u smaller than capture length %u",
pkthdr->len, pkthdr->caplen);
return -1;
}

if (new_len > pkthdr->caplen) {
tcpedit_seterr(tcpedit, "Cannot fuzz packet of capture length %u to length %u",
pkthdr->caplen, new_len);
return -1;
}

if (new_len == pkthdr->len) {
if (new_len == pkthdr->caplen) {
return 0;
}

Expand Down

0 comments on commit f56d2e9

Please sign in to comment.