projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Force nul-termination of strings after vsnprintf().
[tinc]
/
src
/
xmalloc.c
diff --git
a/src/xmalloc.c
b/src/xmalloc.c
index
39dc03c
..
a1b1fe8
100644
(file)
--- a/
src/xmalloc.c
+++ b/
src/xmalloc.c
@@
-155,6
+155,7
@@
int xvasprintf(char **strp, const char *fmt, va_list ap) {
int result = vsnprintf(buf, sizeof buf, fmt, ap);
if(result < 0)
exit(xalloc_exit_failure);
int result = vsnprintf(buf, sizeof buf, fmt, ap);
if(result < 0)
exit(xalloc_exit_failure);
+ buf[sizeof buf - 1] = 0;
*strp = xstrdup(buf);
#else
int result = vasprintf(strp, fmt, ap);
*strp = xstrdup(buf);
#else
int result = vasprintf(strp, fmt, ap);