X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/b9ac23ce92ca22483d56ee3192c54aa8f782f9ac..dff10c7f70d539c431a1eba9ab5e076d8b0f5c8e:/print-isakmp.c?ds=sidebyside diff --git a/print-isakmp.c b/print-isakmp.c index 02b7ca48..5f4abc00 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -30,7 +30,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.8 1999-11-21 09:36:54 fenner Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.10 2000-01-17 06:24:25 itojun Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -989,7 +989,7 @@ static char * numstr(int x) { static char buf[20]; - sprintf(buf, "#%d", x); + snprintf(buf, sizeof(buf), "#%d", x); return buf; } @@ -1001,6 +1001,7 @@ isakmp_print(const u_char *bp, u_int length, const u_char *bp2) u_char np; int i; int phase; + int major, minor; base = (struct isakmp *)bp; ep = (u_char *)snapend; @@ -1011,8 +1012,13 @@ isakmp_print(const u_char *bp, u_int length, const u_char *bp2) } printf("isakmp"); - if (vflag) - printf(" %d.%d", base->v_maj, base->v_min); + if (vflag) { + major = (base->vers & ISAKMP_VERS_MAJOR) + >> ISAKMP_VERS_MAJOR_SHIFT; + minor = (base->vers & ISAKMP_VERS_MINOR) + >> ISAKMP_VERS_MINOR_SHIFT; + printf(" %d.%d", major, minor); + } if (vflag) { printf(" msgid ");