summaryrefslogtreecommitdiff
path: root/print-ascii.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-01-29 15:48:55 -0800
committerGuy Harris <guy@alum.mit.edu>2018-01-29 15:48:55 -0800
commitc499612a7f1024a183d0200ef5f1ea7fba63a3e4 (patch)
tree5ffc65612e07d03e445e58a02d9e349c13eb0af7 /print-ascii.c
parent1e120597d2cb5864d52ca99ca6e167f2454c3153 (diff)
downloadtcpdump-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-ascii.c')
-rw-r--r--print-ascii.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/print-ascii.c b/print-ascii.c
index bd87f6ac..0c347bf0 100644
--- a/print-ascii.c
+++ b/print-ascii.c
@@ -114,7 +114,7 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident,
cp++;
s2 = EXTRACT_U_1(cp);
cp++;
- (void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
+ (void)nd_snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
" %02x%02x", s1, s2);
hsp += HEXDUMP_HEXSTUFF_PER_SHORT;
*(asp++) = (ND_ISGRAPH(s1) ? s1 : '.');
@@ -132,7 +132,7 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident,
if (length & 1) {
s1 = EXTRACT_U_1(cp);
cp++;
- (void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
+ (void)nd_snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
" %02x", s1);
hsp += 3;
*(asp++) = (ND_ISGRAPH(s1) ? s1 : '.');