On Sat, May 15, 2010 at 18:12:57 +0300, Yiannis Marangos wrote: > ettercap-0.7.3-amd64-casting.diff patch has problem because of this: > > - opt_end = (u_char *)((int)tcp + tcp->off * 4); > + opt_end = (u_char *)(tcp + tcp->off * 4); > > the variable tcp is struct tcp_header* and the sizeof(struct tcp_header) > is 20 bytes.. > for example if the tcp is 0x0 and the tcp->off is 5 the result will be > 0x0 + sizeof(struct tcp_header) * 5 * 4 > which is 0x190 instead of 0x20 > a way to correct this problem is to change the datatype int to datatype > long which is always the size of registers so the casting will be correct.. > > i attach a second version of the 64bit-casting patch..
> --- ettercap-0.7.3.orig/src/protocols/ec_tcp.c > +++ ettercap-0.7.3/src/protocols/ec_tcp.c > @@ -116,7 +116,7 @@ > tcp = (struct tcp_header *)DECODE_DATA; > > opt_start = (u_char *)(tcp + 1); > - opt_end = (u_char *)((int)tcp + tcp->off * 4); > + opt_end = (u_char *)((long)tcp + tcp->off * 4); > > DECODED_LEN = (u_int32)(tcp->off * 4); Or you could make that opt_end = (u_char *)tcp + tcp->off * 4 Cheers, Julien
signature.asc
Description: Digital signature