[libvirt] [PATCH] virsh: avoid strncpy

Michal Privoznik mprivozn at redhat.com
Tue May 29 14:54:20 UTC 2012


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

Michal




More information about the libvir-list mailing list