summaryrefslogtreecommitdiff
path: root/smbutil.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 /smbutil.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 'smbutil.c')
-rw-r--r--smbutil.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/smbutil.c b/smbutil.c
index 01f21fe6..c2249c45 100644
--- a/smbutil.c
+++ b/smbutil.c
@@ -1026,17 +1026,17 @@ smb_errstr(int class, int num)
const err_code_struct *err = err_classes[i].err_msgs;
for (j = 0; err[j].name; j++)
if (num == err[j].code) {
- snprintf(ret, sizeof(ret), "%s - %s (%s)",
+ nd_snprintf(ret, sizeof(ret), "%s - %s (%s)",
err_classes[i].class, err[j].name, err[j].message);
return ret;
}
}
- snprintf(ret, sizeof(ret), "%s - %d", err_classes[i].class, num);
+ nd_snprintf(ret, sizeof(ret), "%s - %d", err_classes[i].class, num);
return ret;
}
- snprintf(ret, sizeof(ret), "ERROR: Unknown error (%d,%d)", class, num);
+ nd_snprintf(ret, sizeof(ret), "ERROR: Unknown error (%d,%d)", class, num);
return(ret);
}
@@ -1917,6 +1917,6 @@ nt_errstr(uint32_t err)
return nt_errors[i].name;
}
- snprintf(ret, sizeof(ret), "0x%08x", err);
+ nd_snprintf(ret, sizeof(ret), "0x%08x", err);
return ret;
}