On 12/29/05, ed <[EMAIL PROTECTED]> wrote:
> On Thu, 29 Dec 2005 23:33:48 +0100
> [EMAIL PROTECTED] wrote:
>
> > #include <stdio.h>
>
> #include <string.h>
>
> > char *src = "sehr langer string";
> >
> > void foo( char * src )
> > {
> >       char dst[5];
> >       strcpy( dst, src );
>
> strncpy( dst, src, 4 );
> dst[5] = '\0';

congratulations, you overwrote your buffer.

strlcpy, people, strlcpy.

Reply via email to