r25116: Fix talloc_asprintf_append to do the right thing with
authorJeremy Allison <jra@samba.org>
Wed, 12 Sep 2007 21:41:36 +0000 (21:41 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:30:41 +0000 (12:30 -0500)
truncated strings.
Jeremy.

source/lib/talloc/talloc.c

index c073a8c77432d72c931cb04f1acdbc7e9c397718..c3e5d2c076b87b58f32cce4ec0865db6e87b2951 100644 (file)
@@ -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);