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.
This commit is contained in:
Karl E. Kelley 2005-07-19 03:51:26 +00:00 committed by Jeffrey Altman
parent 0c67857911
commit ef934e388c

View 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);