NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/46827: Cannot build the kernel, even Generic.



On Aug 24,  7:20am, david%l8s.co.uk@localhost (David Laight) wrote:
-- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.

Try this:

christos

--- archive.c   2009/11/07 17:58:17     1.9
+++ archive.c   2012/08/24 10:36:04
@@ -1325,7 +1325,7 @@
   struct ar_hdr *hdr;
   char *temp, *temp1;
   bfd_size_type amt;
-  char tmpbuf[11];
+  char tmpbuf[1024];
 
   if (member && (member->flags & BFD_IN_MEMORY) != 0)
     {
@@ -1365,7 +1365,8 @@
   strncpy (hdr->ar_fmag, ARFMAG, 2);
 
   /* Goddamned sprintf doesn't permit MAXIMUM field lengths.  */
-  sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime);
+  sprintf (tmpbuf, "%-12ld", (long) status.st_mtime);
+  memcpy(hdr->ar_date, tmpbuf, sizeof(hdr->ar_date));
 #ifdef HPUX_LARGE_AR_IDS
   /* HP has a very "special" way to handle UID/GID's with numeric values
      > 99999.  */
@@ -1373,7 +1374,10 @@
     hpux_uid_gid_encode (hdr->ar_gid, (long) status.st_uid);
   else
 #endif
-    sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid);
+  {
+  sprintf (tmpbuf, "%ld", (long) status.st_uid);
+  memcpy(hdr->ar_uid, tmpbuf, sizeof(hdr->ar_uid));
+  }
 #ifdef HPUX_LARGE_AR_IDS
   /* HP has a very "special" way to handle UID/GID's with numeric values
      > 99999.  */
@@ -1381,8 +1385,12 @@
     hpux_uid_gid_encode (hdr->ar_uid, (long) status.st_gid);
   else
 #endif
-  sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid);
-  sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode);
+  {
+  sprintf (tmpbuf, "%ld", (long) status.st_gid);
+  memcpy(hdr->ar_gid, tmpbuf, sizeof(hdr->ar_gid));
+  }
+  sprintf (tmpbuf, "%-8o", (unsigned int) status.st_mode);
+  memcpy(hdr->ar_mode, tmpbuf, sizeof(hdr->ar_mode));
   sprintf (tmpbuf, "%-10ld", (long) status.st_size);
   memcpy(hdr->ar_size, tmpbuf, sizeof(hdr->ar_size));
   /* Correct for a lossage in sprintf whereby it null-terminates.  I cannot


Home | Main Index | Thread Index | Old Index