1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Allocate one 0-byte in asprintf replacement when len==0

Some S3 code depends on this.
(cherry picked from commit dc3d5e1645)
(This used to be commit 842d144b4f)
This commit is contained in:
Volker Lendecke 2008-03-15 21:47:22 +01:00 committed by Stefan Metzmacher
parent 297399d877
commit 3b63333cf2

View File

@ -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;