From ef934e388cdc09e9afe7234aedad318618207104 Mon Sep 17 00:00:00 2001 From: "Karl E. Kelley" Date: Tue, 19 Jul 2005 03:51:26 +0000 Subject: [PATCH] aklog-segfault-fix-20050718 FIXES 20198 I have built openafs 1.3.85 on an emt64 platform on RedHat Enterprise 4, and found that the aklog supplied with 1.3.85 (not the one in the afs-krb5 conversion kit) consistently segfaults when aklog is called with the "-path ...." parm. It works properly when called with no parms. I traced this down to the call to the readlink() call in aklog_main.c, when the params structure references were removed the nesting was changed on an if statement that changed the logic and allowed the do while loop to loop past the end and de-reference a NULL pointer. --- src/aklog/aklog_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aklog/aklog_main.c b/src/aklog/aklog_main.c index bbc8f3977d..f15bb162ce 100644 --- a/src/aklog/aklog_main.c +++ b/src/aklog/aklog_main.c @@ -948,8 +948,8 @@ static char *next_path(char *origpath) ? elast_comp - last_comp : strlen(last_comp); strncat(pathtocheck, last_comp, len); memset(linkbuf, 0, sizeof(linkbuf)); - if ((link = readlink(pathtocheck, linkbuf, - sizeof(linkbuf))) > 0) { + if (link = (readlink(pathtocheck, linkbuf, + sizeof(linkbuf)) > 0)) { if (++symlinkcount > MAXSYMLINKS) { fprintf(stderr, "%s: %s\n", progname, strerror(ELOOP)); exit(AKLOG_BADPATH);