]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-aklog-segfault-fix-20050718
authorKarl E. Kelley <kekelley@iastate.edu>
Tue, 19 Jul 2005 03:51:53 +0000 (03:51 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 19 Jul 2005 03:51:53 +0000 (03:51 +0000)
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.

(cherry picked from commit ef934e388cdc09e9afe7234aedad318618207104)

src/aklog/aklog_main.c

index bbc8f3977dd90087bacafcd3ffd61c13296af5a5..f15bb162cee83a584ad9f87b7069f0fcae8eb0de 100644 (file)
@@ -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);