zmap/zmap — pull request #155 by hmoore-r7 (2014-05-01 19:41:42+00:00)
Title: Fix a segfault when udp->uh_ulen is less than 8

This fixes a crash that occurs when a UDP response is received with a UDP length value less than the size of the UDP header. This cause the CSV output module to segfault and the JSON module to trigger an out of memory error.

An example crash is below:

Program terminated with signal 11, Segmentation fault.
#0 hex_encode (len=18446744073709551608, readbuf=0x7f52dfd5e070

, f=0xfa59d0)
at /root/zmap/src/output_modules/module_csv.c:69
69	fprintf(f, "%02x", readbuf[i]);

A sample packet that triggers this:
6.730450 aaa.bbb.ccc.ddd -> www.xxx.yyy.zzz.186 UDP 60 Source port: distinct Destination port: 51121 [BAD UDP LENGTH 0 < 8]