1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

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

Some S3 code depends on this.
(This used to be commit dc3d5e16452bf30055638ba3cfe99097fb557156)
This commit is contained in:
Volker Lendecke 2008-03-15 21:47:22 +01:00
parent 0bdba8d59a
commit 3351bdeb23

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;