Replace most uses of strncpy with strlcpy.
authorDan Cross <dcross@google.com>
Fri, 16 Oct 2015 16:24:55 +0000 (12:24 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 28 Oct 2015 16:40:41 +0000 (12:40 -0400)
commit925438d89d76187709ca1335b9b97b20deb5def4
tree134201001a5248616b13b769d219e051f965a743
parentcbcf9a3d7f6c6f36e0a7aff66459a38d1c9ee923
Replace most uses of strncpy with strlcpy.

Strncpy has strange and subtle semantics; it was being used
incorrectly in many places. Replace almost everywhere with
strlcpy or memmove.

Note that spatch will in some cases introduce simply incorrect
code when it replaces calls to strcpy; it will take sizeof()
the destination argument, but if that's a pointer, then one
ends up with the size of the pointer type (for our platforms,
8 bytes) instead of the proper size of the destination. When
I saw things like that, I fixed them.

Signed-off-by: Dan Cross <dcross@google.com>
[Minor checkpatch touchups]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
26 files changed:
kern/arch/x86/devarch.c
kern/drivers/dev/acpi.c
kern/drivers/dev/mnt.c
kern/drivers/dev/pci.c
kern/drivers/dev/pipe.c
kern/drivers/dev/proc.c
kern/drivers/dev/root.c
kern/drivers/dev/srv.c
kern/include/ip.h
kern/include/ns.h
kern/src/blockdev.c
kern/src/ext2fs.c
kern/src/kdebug.c
kern/src/kfs.c
kern/src/monitor.c
kern/src/net/arp.c
kern/src/net/devip.c
kern/src/net/dial.c
kern/src/net/ipifc.c
kern/src/net/kernel.h
kern/src/net/netif.c
kern/src/ns/chan.c
kern/src/ns/parse.c
kern/src/ns/qio.c
kern/src/process.c
kern/src/vfs.c