From 3eac35c158bfcc7c8b136eb84bc3e3bcbc9bd186 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 12 Jul 2015 22:22:32 -0700 Subject: [PATCH] GUAC-1171: Handle socket() error return values. --- src/common-ssh/guac_ssh.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common-ssh/guac_ssh.c b/src/common-ssh/guac_ssh.c index 9fcbad50..9aa308d9 100644 --- a/src/common-ssh/guac_ssh.c +++ b/src/common-ssh/guac_ssh.c @@ -374,6 +374,11 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client, /* Get socket */ fd = socket(AF_INET, SOCK_STREAM, 0); + if (fd < 0) { + guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR, + "Unable to create socket: %s", strerror(errno)); + return NULL; + } /* Get addresses connection */ if ((retval = getaddrinfo(hostname, port, &hints, &addresses))) {