diff options
| author | Simo Sorce <simo@redhat.com> | 2016-04-20 15:47:20 -0400 |
|---|---|---|
| committer | Robbie Harwood <rharwood@redhat.com> | 2016-04-22 12:16:54 -0400 |
| commit | 6ceb6126a729c2b4cdcdc381494f35965bdd9318 (patch) | |
| tree | 92edc58b37586e9f53ad2e492dc8eb7ff0e23d9a | |
| parent | 14e33b725c991d6c500ca93e241ed64e1a755843 (diff) | |
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 <simo@redhat.com>
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
| -rw-r--r-- | proxy/src/gssproxy.c | 8 |
1 files changed, 6 insertions, 2 deletions
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; |
