ssldump icon indicating copy to clipboard operation
ssldump copied to clipboard

Compilation warning in pcap/logpkt.c CHKSUM_ADD_RANGE [-Waddress-of-packed-member]

Open wllm-rbnt opened this issue 4 years ago • 0 comments

There is a compilation warning about pointer alignment in pcap/logpkt.c

[...]
gcc -DHAVE_CONFIG_H -I.  -I. -I./common/include -I./common/lib -I./null -I./ssl -I./base -I./pcap -D_DEFAULT_SOURCE=1 -DLINUX -DOPENSSL -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -O2 -c -o pcap/ssldump-pcap_logger.o `test -f 'pcap/pcap_logger.c' || echo './'`pcap/pcap_logger.c
pcap/logpkt.c: In function ‘logpkt_pcap_build’:
pcap/logpkt.c:351:3: warning: converting a packed ‘ip4_hdr_t’ pointer (alignment 1) to a ‘uint16_t’ {aka ‘short unsigned int’} pointer (alignment 2) may result in an unaligned pointer value [-Waddress-of-packed-member]
  351 |   CHKSUM_ADD_RANGE(sum, ip4_hdr, sizeof(ip4_hdr_t));
      |   ^~~~~~~~~~~~~~~~
pcap/logpkt.c:80:9: note: defined here
   80 | typedef struct __attribute__((packed)) {
      |         ^~~~~~
pcap/logpkt.c:399:2: warning: converting a packed ‘tcp_hdr_t’ pointer (alignment 1) to a ‘uint16_t’ {aka ‘short unsigned int’} pointer (alignment 2) may result in an unaligned pointer value [-Waddress-of-packed-member]
  399 |  CHKSUM_ADD_RANGE(sum, tcp_hdr, sizeof(tcp_hdr_t) + payloadlen);
      |  ^~~~~~~~~~~~~~~~
pcap/logpkt.c:102:9: note: defined here
  102 | typedef struct __attribute__((packed)) {
      |         ^~~~~~
[...]

This issue is related to the code imported from https://github.com/droe/sslsplit It is tracked at https://github.com/droe/sslsplit/issues/256

wllm-rbnt avatar Mar 23 '21 15:03 wllm-rbnt