Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > media > main-updates-src > by-pkgid > e7818a279a69740e1e6e2c79ec7e10ec > files > 2

dosfstools-2.11-4mdv2007.1.src.rpm

This violates -D_FORTIFY_SOURCE=2 (which is stricter than C standard),
but isn't actually any buffer overflow.
But using memcpy is more efficient anyway.

--- dosfstools-2.11/mkdosfs/mkdosfs.c.jj	2005-12-18 14:49:16.000000000 -0500
+++ dosfstools-2.11/mkdosfs/mkdosfs.c	2005-12-18 14:49:16.000000000 -0500
@@ -805,7 +805,7 @@ setup_tables (void)
       /* On Atari, the first few bytes of the boot sector are assigned
        * differently: The jump code is only 2 bytes (and m68k machine code
        * :-), then 6 bytes filler (ignored), then 3 byte serial number. */
-    strncpy( bs.system_id-1, "mkdosf", 6 );
+    memcpy( bs.system_id-1, "mkdosf", 6 );
   else
     strcpy (bs.system_id, "mkdosfs");
   if (sectors_per_cluster)