]> granicus.if.org Git - yasm/commitdiff
* coff-objfmt.c (coff_objfmt_output_secthead): Use sprintf instead of
authorPeter Johnson <peter@tortall.net>
Wed, 30 Nov 2005 06:53:06 +0000 (06:53 -0000)
committerPeter Johnson <peter@tortall.net>
Wed, 30 Nov 2005 06:53:06 +0000 (06:53 -0000)
snprintf when outputting /nnn section names; snprintf doesn't port well
to mingw at least.  This also generates more correct output (fills with 0s).

svn path=/trunk/yasm/; revision=1322

modules/objfmts/coff/coff-objfmt.c
modules/objfmts/win32/tests/win32-longsect.hex

index 792e2fc34fc61d66c679048dc1dc9b51b76e8165..aa335fdb7f8712e81e1235b287bb4d8f1ddf737b 100644 (file)
@@ -719,8 +719,9 @@ coff_objfmt_output_secthead(yasm_section *sect, /*@null@*/ void *d)
     /* section name */
     localbuf = info->buf;
     if (strlen(yasm_section_get_name(sect)) > 8) {
-       /* 9 because snprintf always forces a terminating NUL */
-       snprintf((char *)localbuf, 9, "/%ld", csd->strtab_name);
+       char namenum[30];
+       sprintf(namenum, "/%ld", csd->strtab_name);
+       strncpy((char *)localbuf, namenum, 8);
     } else
        strncpy((char *)localbuf, yasm_section_get_name(sect), 8);
     localbuf += 8;
index dbac4fcdd045a5e73d74ae6644a2537de77afe51..25d4812e1094fb82621412698368a8cb2d15d5ce 100644 (file)
@@ -61,8 +61,8 @@
 2f 
 34 
 00 
-78 
-74 
+00 
+00 
 00 
 00 
 00 
 33 
 37 
 00 
-74 
+00 
 00 
 00 
 00 
 35 
 38 
 00 
-74 
-6c 
-79 
-38 
+00 
+00 
+00 
+00 
 0c 
 00 
 00