tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Small patch


From: Domingo Alvarez Duarte
Subject: Re: [Tinycc-devel] Small patch
Date: Thu, 31 Jan 2013 12:45:28 +0000




On Thu, Jan 31, 2013 at 12:36 PM, Thomas Preud'homme <address@hidden> wrote:
Le jeudi 31 janvier 2013 13:19:59, grischka a écrit :
>
> >     > -                strcpy(buf, "__bound_");
> >     > -                strcat(buf, name);
> >     > +                snprintf(buf, sizeof(buf), "__bound_%s", name);
>
> There are cases where we might want to use "pstrcpy" instead of "strcpy".
> This is no such case because "__bound_memcpy" cannot overflow buf[32].
> Same with
>       pstrcpy(buf, sizeof buf, "a.out");
> Because "a.out" cannot overflow buf[1024].

sprintf could be used  then to save some space

>
> --- grischka

Maybe you didn't noticed that snprintf guarantee no buffer overflow while sprintf doesn't !!!!!!!!!!!!!!!!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]