[Mesa-dev] Mesa (master): glapi: s/strcpy/strncpy/

Ian Romanick idr at freedesktop.org
Mon May 3 11:19:59 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vinson Lee wrote:
> Module: Mesa
> Branch: master
> Commit: 9446fd8f69564e09ffd0f28735a99c510f84bb62
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9446fd8f69564e09ffd0f28735a99c510f84bb62
> 
> Author: Vinson Lee <vlee at vmware.com>
> Date:   Sat May  1 15:34:47 2010 -0700
> 
> glapi: s/strcpy/strncpy/
> 
> ---
> 
>  src/mesa/glapi/glapi_getproc.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c
> index c73e8dd..ec96ab3 100644
> --- a/src/mesa/glapi/glapi_getproc.c
> +++ b/src/mesa/glapi/glapi_getproc.c
> @@ -265,7 +265,8 @@ str_dup(const char *str)
>     copy = (char*) malloc(strlen(str) + 1);
>     if (!copy)
>        return NULL;
> -   strcpy(copy, str);
> +   strncpy(copy, str, strlen(str));
> +   copy[strlen(str)] = '\0';
>     return copy;
>  }
>  

Is this commit real, or a joke?  April 1st was a long time ago.  This
change converts a call to strcpy to an open-coded version of strcpy
using strncpy.

NAK.  This makes the code worse by any serious measure.  Please revert.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvfE80ACgkQX1gOwKyEAw/KFwCfWYqkZxOsey8mDX0HKeJqQ1qr
s5sAn1a9N6iLCS1PlcGPKCP3/TSDkfE2
=HBMA
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list