Skip to content

Commit

Permalink
Check that socket() doesn't return -1 in debugserver
Browse files Browse the repository at this point in the history
We checked that setsockopt(), bind() and listen() don't return -1 but
didn't check that socket() didn't return -1. Detected by Coverity scan.
  • Loading branch information
samcv committed May 31, 2018
1 parent a0eb65b commit 853ea27
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/debug/debugserver.c
Expand Up @@ -2534,6 +2534,8 @@ static void debugserver_worker(MVMThreadContext *tc, MVMCallsite *callsite, MVMR
getaddrinfo("localhost", portstr, NULL, &res);

listensocket = socket(res->ai_family, SOCK_STREAM, 0);
if (listensocket == -1)
MVM_panic(1, "Could not create file descriptor for socket: %s", strerror(errno));

#ifndef _WIN32
{
Expand Down

0 comments on commit 853ea27

Please sign in to comment.