diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-01-29 15:48:55 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-01-29 15:48:55 -0800 |
commit | c499612a7f1024a183d0200ef5f1ea7fba63a3e4 (patch) | |
tree | 5ffc65612e07d03e445e58a02d9e349c13eb0af7 /print-sunrpc.c | |
parent | 1e120597d2cb5864d52ca99ca6e167f2454c3153 (diff) | |
download | tcpdump-c499612a7f1024a183d0200ef5f1ea7fba63a3e4.tar.gz |
Add nd_{v}snprintf() routines/wrappers.
Some versions of the MSVC runtime library have a non-C99-compliant
vsnprintf(), which we want to avoid. On Windows, use snprintf() and
vsnprintf() for VS 2015 and later, where they both exist in
C99-compliant forms, and wrap _{v}snprintf_s() otherwise (they're
guaranteed to do the null termination that we want).
Diffstat (limited to 'print-sunrpc.c')
-rw-r--r-- | print-sunrpc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/print-sunrpc.c b/print-sunrpc.c index 749abd1f..74e9db38 100644 --- a/print-sunrpc.c +++ b/print-sunrpc.c @@ -170,13 +170,13 @@ sunrpc_print(netdissect_options *ndo, const u_char *bp, rp = (const struct sunrpc_msg *)bp; if (!ndo->ndo_nflag) { - snprintf(srcid, sizeof(srcid), "0x%x", + nd_snprintf(srcid, sizeof(srcid), "0x%x", EXTRACT_BE_U_4(rp->rm_xid)); strlcpy(dstid, "sunrpc", sizeof(dstid)); } else { - snprintf(srcid, sizeof(srcid), "0x%x", + nd_snprintf(srcid, sizeof(srcid), "0x%x", EXTRACT_BE_U_4(rp->rm_xid)); - snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT); + nd_snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT); } switch (IP_V((const struct ip *)bp2)) { @@ -234,7 +234,7 @@ progstr(uint32_t prog) rp = getrpcbynumber(prog); if (rp == NULL) #endif - (void) snprintf(buf, sizeof(buf), "#%u", prog); + (void) nd_snprintf(buf, sizeof(buf), "#%u", prog); #if defined(HAVE_GETRPCBYNUMBER) && defined(HAVE_RPC_RPC_H) else strlcpy(buf, rp->r_name, sizeof(buf)); |