]> git.proxmox.com Git - mirror_zfs-debian.git/commitdiff
Fix strncat usage
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 26 Aug 2010 17:31:53 +0000 (10:31 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 31 Aug 2010 15:38:46 +0000 (08:38 -0700)
This look like a typo.  The intention was to use strlcat() however
strncat() was used instead accidentally this may lead to a buffer
overflow.  This was caught by gcc -D_FORTIFY_SOURCE=2.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
lib/libzfs/libzfs_sendrecv.c

index c6d684c4c1d6e8804884dd5b30f6e048114b77da..95c4b35688b50f86a6a2f25b10ec2341280a80a0 100644 (file)
@@ -2467,7 +2467,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
         */
        (void) strcpy(zc.zc_top_ds, tosnap);
        (void) strcpy(zc.zc_value, tosnap);
-       (void) strncat(zc.zc_value, chopprefix, sizeof (zc.zc_value));
+       (void) strlcat(zc.zc_value, chopprefix, sizeof (zc.zc_value));
        free(cp);
        if (!zfs_name_valid(zc.zc_value, ZFS_TYPE_SNAPSHOT)) {
                zcmd_free_nvlists(&zc);