> On Dec 3, 2020, at 10:34 AM, Dave Fisher <w...@apache.org> wrote:
>> index f27a04e..5f60f73 100644
>> --- a/main/soltools/mkdepend/parse.c
>> +++ b/main/soltools/mkdepend/parse.c
>> @@ -346,7 +346,11 @@ int deftype (line, filep, file_red, file, parse_it,
>> symbols)
>> /*
>> * copy the definition back to the beginning of the line.
>> */
>> - strcpy (line, p);
>> + {
>> + int len = strlen(line);
>> + memmove (line, p, len);
>> + line[len] = '\0';
>
> Shouldn’t this be:
>
> p[len] = ‘\0’;
>
> Or memove len+1
>
> Regards,
> Dave
Both strcpy and memmove are (dst, src...), so we are copying from p to line. We
want to ensure that we only copy as much as line will hold. So we look at how
big line is, copy that many bytes from p to line and then ensure a closing NUL
(which is a failsafe).
But upon review, we should also check for strlen(p) as well and just copy the
smaller number of char... but the core dumps were due to p being too big.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org