tcpdump mailing list archives

new print-tcp.c 1.127 in CVS puts NUL character in options


From: Alexander Dupuy <alex.dupuy () mac com>
Date: Tue, 03 Apr 2007 15:27:43 -0400

There's a minor bug in the tcp_print() function introduced in Hannes' rewrite in version 1.127 of print-tcp.c. A NUL ('\0') character is printed after the open bracket '[' and before other options. If you're just printing to a TTY, you probably won't see the NUL, but it's definitely there, e.g.:

15:59:28.899291 IP 172.16.1.38.6000 > 172.16.1.50.33242: Flags [P.], ack 6490348
40, win 62864, options [^@nop,nop,TS val 167404903 ecr 96469202], length 320

The fix is easy:
*** print-tcp.c 29 Jan 2007 19:19:51 -0000      1.128
--- print-tcp.c 3 Apr 2007 19:25:24 -0000
***************
*** 463,469 ****
                 cp = (const u_char *)tp + sizeof(*tp);
                 printf(", options [");
                 while (hlen > 0) {
!                         putchar(ch);
                         TCHECK(*cp);
                         opt = *cp++;
                         if (ZEROLENOPT(opt))
--- 463,470 ----
                 cp = (const u_char *)tp + sizeof(*tp);
                 printf(", options [");
                 while (hlen > 0) {
!                         if (ch != '\0')
!                                 putchar(ch);
                         TCHECK(*cp);
                         opt = *cp++;
                         if (ZEROLENOPT(opt))


@alex

--
mailto:alex.dupuy () mac com

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: