[RFC PATCH] data_blob_realloc() accept 0 length argument

jim jim.brown at rsmas.miami.edu
Fri Feb 16 02:40:34 UTC 2018


You should use '&& length > 0' and not just '&& length' to test for 
non-zero.

On 2/15/2018 9:24 PM, Timur I. Bakeyev via samba-technical wrote:
> --- data_blob.c.orig	2018-02-16 03:10:52.382226000 +0100
> +++ data_blob.c	2018-02-16 03:14:21.640659000 +0100
> @@ -213,7 +213,7 @@_PUBLIC_  DATA_BLOB data_blob_const(const
>   _PUBLIC_  bool data_blob_realloc(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t length)
>   {
>   	blob->data = talloc_realloc(mem_ctx, blob->data, uint8_t, length);
> -	if (blob->data == NULL)
> +	if (blob->data == NULL && length)
>   		return false;
>   	blob->length = length;
>   	return true;




More information about the samba-technical mailing list