summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/k5-platform.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h
index 77d710b49..d1896e7f8 100644
--- a/src/include/k5-platform.h
+++ b/src/include/k5-platform.h
@@ -958,8 +958,10 @@ vsnprintf(char *str, size_t size, const char *format, va_list args)
va_copy(args_copy, args);
length = _vscprintf(format, args_copy);
va_end(args_copy);
- if (size)
+ if (size > 0) {
_vsnprintf(str, size, format, args);
+ str[size - 1] = '\0';
+ }
return length;
}
static inline int