From: guy Date: Wed, 12 Dec 2001 07:16:40 +0000 (+0000) Subject: The payload of an SCTP DATA chunk is *not* necessarily ASCII text, so it X-Git-Tag: tcpdump-3.7.1~12 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/153e205db74c3bc57d40c5118dbaedefc210ba07 The payload of an SCTP DATA chunk is *not* necessarily ASCII text, so it shouldn't be printed by directly sending it to the standard output; print it with "default_print()" if neither the "-x" nor the "-q" flag were set. --- diff --git a/print-sctp.c b/print-sctp.c index 2d1987b2..2ee6b25d 100644 --- a/print-sctp.c +++ b/print-sctp.c @@ -35,7 +35,7 @@ #ifndef lint static const char rcsid[] = -"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.6 2001-12-11 09:41:54 guy Exp $ (NETLAB/PEL)"; +"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.7 2001-12-12 07:16:40 guy Exp $ (NETLAB/PEL)"; #endif #ifdef HAVE_CONFIG_H @@ -207,14 +207,16 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */ { /* at the command line */ char *payloadPtr; - printf("[Payload: {"); + printf("[Payload"); - payloadPtr = (char *) (++dataHdrPtr); - fwrite(payloadPtr, - htons(chunkDescPtr->chunkLength)-1 - - sizeof(struct sctpDataPart)-sizeof(struct sctpChunkDesc), - 1, stdout); - printf("}] "); + if (!xflag && !qflag) { + payloadPtr = (char *) (++dataHdrPtr); + printf(":"); + default_print(payloadPtr, + htons(chunkDescPtr->chunkLength)-1 - + sizeof(struct sctpDataPart)-sizeof(struct sctpChunkDesc)); + } else + printf("]"); } break; }