#2 ng client, core dump on OpenSolaris

open-fixed
nobody
None
5
2010-03-14
2009-09-22
Anonymous
No

Nailgun client will segfault on OpenSolaris, it appears to be because the strlen function on Solaris purposely doesn't handle nulls.

http://technopark02.blogspot.com/2006/04/solaris-null-pointer-bugs-usrlib00so1.html

To fix I modified the sendText function:

void sendText(char chunkType, char *text) {
int len = 0;
if ( text ) {
len = strlen(text);
}
sendHeader(len, chunkType);
sendAll(nailgunsocket, text, len);
}

Discussion

  • Marty Lamb

    Marty Lamb - 2010-03-14

    Fixed in rev 95. Thanks for the fix!

     
  • Marty Lamb

    Marty Lamb - 2010-03-14
    • status: open --> open-fixed
     
  • Mike Meyer

    Mike Meyer - 2010-07-28

    The root cause here is that getcwd on opensolaris is weird. If the first argument you pass it is NULL, it allocates space according to the second argument instead of figuring out how much it should allocate itself and ignoring the second argument. I changed the lone call to getcwd to pass it NULL, MAXPATHLEN (which required adding #include <sys/param.h>). Without that, getcwd was returning a NULL pointer which then got passed to SendText.

     

Log in to post a comment.