summaryrefslogtreecommitdiff
path: root/source4/lib/replace
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-03-15 21:47:22 +0100
committerStefan Metzmacher <metze@samba.org>2008-03-18 13:48:21 +0100
commit3b63333cf272fae301e22e9a021f0bbf60d1c413 (patch)
tree9042af9b64e3eb7dec932d88e1d3bddd10dcc2b1 /source4/lib/replace
parent297399d877476bd72fbf8055cd728b6f8230ba09 (diff)
downloadsamba-3b63333cf272fae301e22e9a021f0bbf60d1c413.tar.gz
samba-3b63333cf272fae301e22e9a021f0bbf60d1c413.tar.bz2
samba-3b63333cf272fae301e22e9a021f0bbf60d1c413.zip
Allocate one 0-byte in asprintf replacement when len==0
Some S3 code depends on this. (cherry picked from commit dc3d5e16452bf30055638ba3cfe99097fb557156) (This used to be commit 842d144b4fb0981250157f72956e732709663107)
Diffstat (limited to 'source4/lib/replace')
-rw-r--r--source4/lib/replace/snprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source4/lib/replace/snprintf.c b/source4/lib/replace/snprintf.c
index 9f8a7657e5..a174dcffed 100644
--- a/source4/lib/replace/snprintf.c
+++ b/source4/lib/replace/snprintf.c
@@ -1264,7 +1264,7 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
VA_COPY(ap2, ap);
ret = vsnprintf(NULL, 0, format, ap2);
va_end(ap2);
- if (ret <= 0) return ret;
+ if (ret < 0) return ret;
(*ptr) = (char *)malloc(ret+1);
if (!*ptr) return -1;