]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
newfs_msdos: prefer snprintf to sprintf
authoremaste <emaste@FreeBSD.org>
Fri, 16 Oct 2015 15:19:36 +0000 (15:19 +0000)
committeremaste <emaste@FreeBSD.org>
Fri, 16 Oct 2015 15:19:36 +0000 (15:19 +0000)
Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation

sbin/newfs_msdos/mkfs_msdos.c

index f4222700365be1c0c5842b0e05e3ae9e0334664e..28280359974285e3c8bdf1817268b2bd5abada34 100644 (file)
@@ -585,7 +585,7 @@ int mkfs_msdos(const char *fname, const char *dtype,
                          (u_int)tm->tm_min));
                mk4(bsx->exVolumeID, x);
                mklabel(bsx->exVolumeLabel, o.volume_label ? o.volume_label : "NO NAME");
-               sprintf(buf, "FAT%u", fat);
+               snprintf(buf, sizeof(buf), "FAT%u", fat);
                setstr(bsx->exFileSysType, buf, sizeof(bsx->exFileSysType));
                if (!o.bootstrap) {
                    x1 += sizeof(struct bsx);