setup-x86_64: postinstall errors: Package bash 1, Package a2ps 2 and xinit 134

Jon TURNEY jon.turney@dronecode.org.uk
Mon Jul 29 01:36:00 GMT 2013


On 25/07/2013 05:24, Kenneth Wolcott wrote:
>   I downloaded a fresh setup-x86_64.exe from cygwin.com and then ran
> the update again.
> 
>   Now I get only this postinstall error:
> 
>   Package: xinit
>     xinit.sh exit code 134
I can reproduce this problem, so I had a go at investigating and fixing it.

mkshortcut appears to exiting with SIGABRT in free(), which suggests some heap
corruption, which I managed to track down after a bit of work with dmalloc.

This appears to be a long standing bug, which for some reason manifests itself
more severely on x86_64.

xstrncat() does not allow for the terminating null byte in the memory
allocation it makes.  strncat(dest, src, n) writes n+1 bytes to dest (n from
src plus the terminating null byte, which is always appended).  So, the size
of dest must be at least strlen(dest)+n+1.  Currently only strlen(dest)+n
bytes are allocated.

Trivial patch attached.

-------------- next part --------------
--- origsrc/cygutils-1.4.12/src/mkshortcut/mkshortcut.c	2013-04-28 00:17:56.000000000 +0100
+++ src/cygutils-1.4.12/src/mkshortcut/mkshortcut.c	2013-07-28 22:36:54.890625000 +0100
@@ -394,7 +394,7 @@ xstrndup (const char *string, size_t n)
 static char *
 xstrncat (char **dest, const char *add, size_t n)
 {
-  size_t len = strlen (*dest) + n;
+  size_t len = strlen (*dest) + n + 1;
   char *s = (char *) realloc (*dest, len * sizeof (char));
   if (!s)
   {

-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list