On Thu, Jan 31, 2013 at 12:36 PM, Thomas Preud'homme <robo...@celest.fr>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 !!!!!!!!!!!!!!!!
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to