[CinCV TNG] [PATCH] Terminate command string in Pipe properly

Johannes Sixt j6t at kdbg.org
Mon Nov 30 21:27:49 CET 2015


Am 30.11.2015 um 19:06 schrieb Einar R√ľnkaru:
> Subject: [PATCH] Terminate command string in Pipe properly
>
> ---
>   cinelerra/pipe.C | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/cinelerra/pipe.C b/cinelerra/pipe.C
> index 87b8199..246496d 100644
> --- a/cinelerra/pipe.C
> +++ b/cinelerra/pipe.C
> @@ -96,7 +96,7 @@ int Pipe::substitute()
>   		}
>
>   		// insert the file string at the substitution point
> -		if (f + strlen(sub_str) - complete > sizeof(complete))
> +		if (f + strlen(sub_str) - complete > sizeof(complete) - 1)
>   		{
>   			printf("Pipe::substitute(): max length exceeded\n");
>   			return -1;
> @@ -105,7 +105,7 @@ int Pipe::substitute()
>   		f += strlen(sub_str);
>   		count++;
>   	}
> -
> +	*f = 0;
>   	return count;
>   }

This looks right, and the original code completely bogus. How can this 
have gone unnoticed? Is the object zero-initialized so that usually 
there is a terminating NUL?

-- Hannes



More information about the Cinelerra mailing list