[libvirt] [PATCH] virsh: avoid strncpy

Eric Blake eblake at redhat.com
Tue May 29 15:49:04 UTC 2012


On 05/29/2012 08:54 AM, Michal Privoznik wrote:
> On 29.05.2012 16:36, Eric Blake wrote:
>> strncpy is generally evil - it runs the risk of missing NUL
>> termination, and more often than not wastes time zeroing way
>> more bytes than strictly necessary.  We've avoided this evil
>> in our virStrncpy wrapper, except for places where we forgot
>> to use the wrapper; meanwhile, we have also added an even
>> higher layer wrapper for setting virTypedParameter values.
>>
>> * tools/virsh.c (cmdMemtune, cmdBlkdeviotune): Use modern API.
>> * cfg.mk (exclude_file_name_regexp--sc_prohibit_strncpy): Tighten.
>> ---
>>
>> Noticed this while updating to the latest gnulib.
>>
>>  cfg.mk        |    3 +-
>>  tools/virsh.c |  149 +++++++++++++++++++++++++++++----------------------------
>>  2 files changed, 76 insertions(+), 76 deletions(-)
>>
> 
> ACK

Thanks; pushed.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120529/259f6f96/attachment-0001.sig>


More information about the libvir-list mailing list