summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-09-12 21:41:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:06:42 -0500
commitd8a5ed33b36d7666b04673298a9b67f06cc36687 (patch)
treeaf1689fdb53d74bbb2c3f9149971a6d7bf2acedc /source4
parent95b8ab07f048c43f4e74dedb1b84a865a8503936 (diff)
downloadsamba-d8a5ed33b36d7666b04673298a9b67f06cc36687.tar.gz
samba-d8a5ed33b36d7666b04673298a9b67f06cc36687.tar.bz2
samba-d8a5ed33b36d7666b04673298a9b67f06cc36687.zip
r25116: Fix talloc_asprintf_append to do the right thing with
truncated strings. Jeremy. (This used to be commit 948d32bb62b0e8c68cc961a380eae602ffc71870)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/talloc/talloc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c
index c073a8c774..c3e5d2c076 100644
--- a/source4/lib/talloc/talloc.c
+++ b/source4/lib/talloc/talloc.c
@@ -1226,8 +1226,7 @@ char *talloc_asprintf(const void *t, const char *fmt, ...)
* accumulating output into a string buffer.
**/
char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
-{
- struct talloc_chunk *tc;
+{
int len, s_len;
va_list ap2;
char c;
@@ -1236,9 +1235,7 @@ char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
return talloc_vasprintf(NULL, fmt, ap);
}
- tc = talloc_chunk_from_ptr(s);
-
- s_len = tc->size - 1;
+ s_len = strlen(s);
va_copy(ap2, ap);
len = vsnprintf(&c, 1, fmt, ap2);