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

Brian Paul brianp at vmware.com
Mon May 3 12:18:03 PDT 2010


Ian Romanick wrote:
> -----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.

I've reverted it.

-Brian



More information about the mesa-dev mailing list