From 6ceb6126a729c2b4cdcdc381494f35965bdd9318 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 20 Apr 2016 15:47:20 -0400 Subject: Fix crash bug when reconfiguring service If the socket is null the strcmp will segfault. Check for equality of pointers or nullity before entering the strcmp() Signed-off-by: Simo Sorce Reviewed-by: Robbie Harwood --- proxy/src/gssproxy.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'proxy') diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c index bcf236b..02edbac 100644 --- a/proxy/src/gssproxy.c +++ b/proxy/src/gssproxy.c @@ -89,8 +89,12 @@ static int init_sockets(verto_ctx *vctx, struct gp_config *old_config) if (old_config->svcs[i]->ev) { svc = find_service_by_name(gpctx->config, old_config->svcs[i]->name); - if (svc && strcmp(svc->socket, - old_config->svcs[i]->socket) == 0) { + if (svc && + ((svc->socket == old_config->svcs[i]->socket) || + ((svc->socket != NULL) && + (old_config->svcs[i]->socket != NULL) && + strcmp(svc->socket, + old_config->svcs[i]->socket) == 0))) { svc->ev = old_config->svcs[i]->ev; sock_ctx = verto_get_private(svc->ev); sock_ctx->socket = svc->socket; -- cgit