From 2e81f689c28fdbb65696d0b501ac9ce3b288a0c0 Mon Sep 17 00:00:00 2001 From: Kenneth G Raeburn Date: Wed, 19 Oct 1988 18:24:25 +0000 Subject: Checking that logout notices are for the sender; verify that pointer values are NULL before calling free(). --- server/uloc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'server/uloc.c') diff --git a/server/uloc.c b/server/uloc.c index 5ed666c..148f882 100644 --- a/server/uloc.c +++ b/server/uloc.c @@ -177,7 +177,7 @@ ZServerDesc_t *server; server_forward(notice, auth, who); return(ZERR_NONE); } - if (!auth) { + if (!auth || strcmp(notice->z_sender, notice->z_class_inst)) { zdbug((LOG_DEBUG,"unauthentic ulogin")); sense_logout(notice, who); if (server == me_server) @@ -450,7 +450,8 @@ struct in_addr *addr; i++; } - xfree(locations); + if (locations) + xfree(locations); if (!new_num) { zdbug((LOG_DEBUG,"no more locs")); @@ -509,7 +510,8 @@ struct sockaddr_in *sin; i++; } - xfree(locations); + if (locations) + xfree(locations); if (!new_num) { zdbug((LOG_DEBUG,"no more locs")); @@ -688,7 +690,8 @@ struct sockaddr_in *who; locations[i] = oldlocs[i - 1]; i++; } - xfree(oldlocs); + if (oldlocs) + xfree(oldlocs); (void) sigsetmask(omask); #ifdef DEBUG -- cgit v1.2.3