diff options
author | Jim Meyering <meyering@redhat.com> | 2012-10-04 13:09:57 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-10-05 07:58:37 -0500 |
commit | 9d055d8ac83cfd590263e8862ff683f705dfdf56 (patch) | |
tree | 2e4814f2a137d7f863c17f2d493f4895cc5f6e67 /hw/spapr_vscsi.c | |
parent | 9238c2099d37748a4e2cbbe709ed1ebffa6f3c8b (diff) | |
download | qemu-9d055d8ac83cfd590263e8862ff683f705dfdf56.zip qemu-9d055d8ac83cfd590263e8862ff683f705dfdf56.tar.gz qemu-9d055d8ac83cfd590263e8862ff683f705dfdf56.tar.bz2 |
vscsi: avoid unwarranted strncpy
Don't use strncpy when the source string is known to fit
in the destination buffer. Use equivalent memcpy.
We could even use strcpy, here, but some static analyzers
warn about that, so don't add new uses.
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/spapr_vscsi.c')
-rw-r--r-- | hw/spapr_vscsi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c index 3cf5844..e3d4b23 100644 --- a/hw/spapr_vscsi.c +++ b/hw/spapr_vscsi.c @@ -737,7 +737,7 @@ static int vscsi_send_adapter_info(VSCSIState *s, vscsi_req *req) #endif memset(&info, 0, sizeof(info)); strcpy(info.srp_version, SRP_VERSION); - strncpy(info.partition_name, "qemu", sizeof("qemu")); + memcpy(info.partition_name, "qemu", sizeof("qemu")); info.partition_number = cpu_to_be32(0); info.mad_version = cpu_to_be32(1); info.os_type = cpu_to_be32(2); |