This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Sync pseudo-reloc.c, round #2


Charles Wilson wrote:
> Thx. Committed. Now I've just got to get the mingw version committed,
> and then take the 2-liner revision back to mingw64...

Aaaargh.  While preparing the final synchronization patch for the
mingw64 folks, I noticed a *second* error path that I had not yet tested
-- and it had the same bug. The attached patch fixes that one (the
synchronization patch I just sent to the mingw64 guys includes this change).

2009-10-26  Charles Wilson  <...>

        * lib/pseudo-reloc.c (__report_error) [CYGWIN]: Correct size bug
        regarding error messages.

Tested the affected error path, and the normal code path, with this change.

OK? (and sorry for all the churn; hopefully this is the last of it)

--
Chuck
Index: pseudo-reloc.c
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/lib/pseudo-reloc.c,v
retrieving revision 1.3
diff -u -p -r1.3 pseudo-reloc.c
--- pseudo-reloc.c	25 Oct 2009 23:37:48 -0000	1.3
+++ pseudo-reloc.c	26 Oct 2009 14:32:33 -0000
@@ -93,7 +93,8 @@ __report_error (const char *msg, ...)
   char buf[SHORT_MSG_BUF_SZ];
   wchar_t module[MAX_PATH];
   char * posix_module = NULL;
-  static const char * UNKNOWN_MODULE = "<unknown module>: ";
+  static const char   UNKNOWN_MODULE[] = "<unknown module>: ";
+  static const size_t UNKNOWN_MODULE_LEN = sizeof (UNKNOWN_MODULE) - 1;
   static const char   CYGWIN_FAILURE_MSG[] = "Cygwin runtime failure: ";
   static const size_t CYGWIN_FAILURE_MSG_LEN = sizeof (CYGWIN_FAILURE_MSG) - 1;
   DWORD len;
@@ -130,7 +131,7 @@ __report_error (const char *msg, ...)
       WriteFile (errh, (PCVOID)CYGWIN_FAILURE_MSG,
                  CYGWIN_FAILURE_MSG_LEN, &done, NULL);
       WriteFile (errh, (PCVOID)UNKNOWN_MODULE,
-                 sizeof(UNKNOWN_MODULE), &done, NULL);
+                 UNKNOWN_MODULE_LEN, &done, NULL);
       WriteFile (errh, (PCVOID)buf, len, &done, NULL);
     }
   WriteFile (errh, (PCVOID)"\n", 1, &done, NULL);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]