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

Einar Rünkaru einarrunkaru at gmail.com
Mon Nov 30 21:52:10 CET 2015



On 11/30/2015 10:27 PM, Johannes Sixt wrote:
> 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?

Usually % was the last symbol. Then strcpy terminated the string.

Einar


More information about the Cinelerra mailing list