libcacard/vcard_emul_nss: use pstrcpy in place of strncpy
Replace strncpy+NUL-terminate use with use of pstrcpy.This requires linking with cutils.o (or else vssclient doesn't link),so add that in the Makefile.
Acked-by: Alon Levy <alevy@redhat.com>Signed-off-by: Jim Meyering <meyering@redhat.com>...
lm32: avoid buffer overrun
Actually do what the comment says, using pstrcpy NUL-terminate:strncpy does not always do that.
Signed-off-by: Jim Meyering <meyering@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
os-posix: avoid buffer overrun
os_set_proc_name: Use pstrcpy, in place of strncpy and theineffectual preceding assignment: name[sizeof(name) - 1] = 0;
ppc: avoid buffer overrun: use pstrcpy, not strncpy
A terminal NUL is required by caller's use of strchr.It's better not to use strncpy at all, since there is no needto zero out hundreds of trailing bytes for each iteration.
Signed-off-by: Jim Meyering <meyering@redhat.com>...
linux-user: remove two unchecked uses of strdup
Remove two uses of strdup (use g_path_get_basename instead),and add a comment that this strncpy use is ok.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Jim Meyering <meyering@redhat.com>...
ui/vnc: simplify and avoid strncpy
Don't bother with strncpy. There's no need for its zero-fill.Use g_strndup in place of g_malloc+strncpy+NUL-terminate.
bt: replace fragile snprintf use and unwarranted strncpy
In bt_hci_name_req a failed snprintf could return len larger thansizeof(params.name), which means the following memset call wouldhave a "length" value of (size_t)-1, -2, etc... Sounds scary.But currently, one can deduce that there is no problem:...
virtio-9p: avoid unwarranted uses of strncpy
In all of these cases, the uses of strncpy were unnecessary, sinceat each point of use we know that the NUL-terminated source bytesfit in the destination buffer. Use memcpy in place of strncpy.
Acked-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>...
vscsi: avoid unwarranted strncpy
Don't use strncpy when the source string is known to fitin the destination buffer. Use equivalent memcpy.We could even use strcpy, here, but some static analyzerswarn about that, so don't add new uses.
Acked-by: David Gibson <david@gibson.dropbear.id.au>...
qemu-ga: prefer pstrcpy: consistently NUL-terminate ifreq.ifr_name
NUL-termination of the .ifr_name field is not required, but is fine(and preferable to using strncpy and leaving the reader to wonder),since the first thing the linux kernel does is to clear the last byte....
View all revisions | View revisions
Also available in: Atom