summaryrefslogtreecommitdiff
path: root/contrib/amd/libamu/xutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/amd/libamu/xutil.c')
-rw-r--r--contrib/amd/libamu/xutil.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/amd/libamu/xutil.c b/contrib/amd/libamu/xutil.c
index 5ba4938f9ae7..bd1bcf576ef5 100644
--- a/contrib/amd/libamu/xutil.c
+++ b/contrib/amd/libamu/xutil.c
@@ -422,13 +422,17 @@ real_plog(int lvl, char *fmt, va_list vargs)
expand_error(fmt, efmt, 1024);
+#ifdef HAVE_VSNPRINTF
+ vsnprintf(ptr, 1024, efmt, vargs);
+#else /* not HAVE_VSNPRINTF */
/*
* XXX: ptr is 1024 bytes long. It is possible to write into it
* more than 1024 bytes, if efmt is already large, and vargs expand
- * as well.
+ * as well. This is not as safe as using vsnprintf().
*/
vsprintf(ptr, efmt, vargs);
msg[1023] = '\0'; /* null terminate, to be sure */
+#endif /* not HAVE_VSNPRINTF */
ptr += strlen(ptr);
if (ptr[-1] == '\n')