mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 17:10:48 +00:00
fix potential unterminated buffer and leak on failure
This commit is contained in:
parent
b76089f0cd
commit
65ac0eca15
2 changed files with 2 additions and 1 deletions
|
@ -1282,7 +1282,7 @@ typedef struct {
|
|||
memset(&sockAddr, '\0', sizeof(sockAddr));
|
||||
sockAddr.sun_family = AF_LOCAL;
|
||||
strncpy(sockAddr.sun_path, (char*)socketName,
|
||||
sizeof(sockAddr.sun_path));
|
||||
sizeof(sockAddr.sun_path) - 1);
|
||||
if ((desc = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0)
|
||||
{
|
||||
NSLog(@"unable to create socket - %@", [NSError _last]);
|
||||
|
|
|
@ -375,6 +375,7 @@ static NSMapTable *portToNamesMap;
|
|||
}
|
||||
if (connect(desc, (struct sockaddr*)&sockAddr, SUN_LEN(&sockAddr)) < 0)
|
||||
{
|
||||
close(desc);
|
||||
unlink([path fileSystemRepresentation]);
|
||||
unlink(socket_path);
|
||||
NSDebugLLog(@"NSMessagePort", @"not live, can't connect (%m)");
|
||||
|
|
Loading…
Reference in a new issue