[cvs] bogofilter/src xstrdup.c,1.1,1.2 xstrdup.h,1.1,1.2

Matthias Andree matthias.andree at gmx.de
Mon Feb 17 12:32:51 CET 2003


relson at users.sourceforge.net writes:

> diff -u -d -r1.1 -r1.2
> --- xstrdup.c	3 Feb 2003 16:55:15 -0000	1.1
> +++ xstrdup.c	14 Feb 2003 12:37:21 -0000	1.2
> @@ -12,7 +12,8 @@
>  #include "xstrdup.h"
>  
>  char *xstrdup(const char *s) {
> -    char *t = xmalloc(strlen(s) + 1);
> -    strcpy(t, s); /* RATS: ignore */
> +    size_t l = strlen(s) + 1;
> +    char *t = xmalloc(l);
> +    memcpy(t, s, l); /* RATS: ignore */
>      return t;
>  }

I think we don't need the RATS tag on memcpy (only strcpy). memcpy
doesn't overrun buffers usually. Committing removal.

-- 
Matthias Andree




More information about the bogofilter-dev mailing list