20 Sep 2007 21:45
Re: [diff] strcpy/strcat -> strlcpy/strlcat
Otto Moerbeek <otto <at> drijf.net>
2007-09-20 19:45:18 GMT
2007-09-20 19:45:18 GMT
On Wed, 19 Sep 2007, Gilles Chehade wrote:
> Hi,
>
> Here's a diff to replace remaining strcpy/strcat with strlcpy/strlcat in pcc/cc
This diff looks good to me,
-Otto
>
> Gilles
>
>
> Index: cpp/cpp.c
> ===================================================================
> RCS file: /local/cvsroot/pcc/cc/cpp/cpp.c,v
> retrieving revision 1.61
> diff -u -p -r1.61 cpp.c
> --- cpp/cpp.c 18 Sep 2007 20:15:58 -0000 1.61
> +++ cpp/cpp.c 19 Sep 2007 22:44:28 -0000
> <at> <at> -427,7 +427,9 <at> <at> line()
> llen = c;
> }
> yytext[strlen(yytext)-1] = 0;
> - strcpy((char *)lbuf, &yytext[1]);
> + if (strlcpy((char *)lbuf, &yytext[1], SBSIZE) >= SBSIZE)
> + error("line exceeded buffer size");
> +
(Continue reading)
I've added it.
-- Ragge
>> Gilles
>>
>>
>> Index: cpp/cpp.c
>> ===================================================================
>> RCS file: /local/cvsroot/pcc/cc/cpp/cpp.c,v
>> retrieving revision 1.61
>> diff -u -p -r1.61 cpp.c
>> --- cpp/cpp.c 18 Sep 2007 20:15:58 -0000 1.61
>> +++ cpp/cpp.c 19 Sep 2007 22:44:28 -0000
>> <at> <at> -427,7 +427,9 <at> <at> line()
>> llen = c;
>> }
RSS Feed