From 4754b0ec65a3be4380f3216bd3f59c1906db259b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 12 Sep 2007 21:41:36 +0000 Subject: r25116: Fix talloc_asprintf_append to do the right thing with truncated strings. Jeremy. (This used to be commit 93c42fd9b52d9135d8c8b52e97cf342c1c5b5010) --- source3/lib/talloc/talloc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source3') diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c index c073a8c774..c3e5d2c076 100644 --- a/source3/lib/talloc/talloc.c +++ b/source3/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); -- cgit