Ettercap/ettercap — pull request #101 by jacob-baines (2013-03-03 15:21:09+00:00)
Title: Del_decoder Overlapping Source and Destination

ec_decode.c's del_decoder() function contains an overlapping memcpy when e == the last entry in the protocols table.

==11458== Source and destination overlap in memcpy(0x536b194, 0x536b194, 12)
==11458== at 0x402D50D: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==11458== by 0x8059E0B: del_decoder (ec_decode.c:458)
==11458== by 0x805A59B: dissect_del (ec_dissect.c:210)
==11458== by 0x805A6C6: dissect_modify (ec_dissect.c:246)
==11458== by 0x8057E4B: set_dissector (ec_conf.c:436)
==11458== by 0x8057B85: load_conf (ec_conf.c:333)
==11458== by 0x8061D1B: main (ec_main.c:92)

While this might not seem concerning it is actually undefined behavior. Valgrind's blurb on the error is quite good: http://valgrind.org/docs/manual/mc-manual.html#mc-manual.overlap

The fix I implemented was only to copy when e != the last protocol. Another solution would be to use memmove. This can be recreated with the default config file.