summaryrefslogtreecommitdiff
path: root/source3
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 12:30:41 -0500
commit4754b0ec65a3be4380f3216bd3f59c1906db259b (patch)
treee76c0ea024c5305e7197a56da038f73044171b15 /source3
parent3a9d3821649c9ea88a6cd424f0838a453165a00a (diff)
downloadsamba-4754b0ec65a3be4380f3216bd3f59c1906db259b.tar.gz
samba-4754b0ec65a3be4380f3216bd3f59c1906db259b.tar.bz2
samba-4754b0ec65a3be4380f3216bd3f59c1906db259b.zip
r25116: Fix talloc_asprintf_append to do the right thing with
truncated strings. Jeremy. (This used to be commit 93c42fd9b52d9135d8c8b52e97cf342c1c5b5010)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/talloc/talloc.c7
1 files changed, 2 insertions, 5 deletions
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);