From: Anders Kaseorg Date: Tue, 30 Sep 2014 17:52:31 +0000 (-0400) Subject: aklog: Fix segfault on aklog -path X-Git-Tag: upstream/1.8.0_pre1^2~563 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=fbea3265b3bc042b97be17229839ccf7d11a0bf9;p=packages%2Fo%2Fopenafs.git aklog: Fix segfault on aklog -path Commit 2fac53522e7ef5b3a376e191bffdc1f6784e6995 “aklog: Fix improper use of readlink” inadvertently changed the meaning of int link from a boolean flag (length > 0) to just a length. This caused ‘aklog -path (anything)’ to segfault. Update the type of link and the condition of the while loop to account for this change. FIXES 131930 Change-Id: Ia05836795425a53e858ab29866900f6d45970644 Reviewed-on: http://gerrit.openafs.org/11517 Reviewed-by: Anders Kaseorg Tested-by: Anders Kaseorg Reviewed-by: Benjamin Kaduk Reviewed-by: Stephan Wiesand Tested-by: Stephan Wiesand Reviewed-by: D Brashear --- diff --git a/src/aklog/aklog.c b/src/aklog/aklog.c index eaead4478..a21da6c53 100644 --- a/src/aklog/aklog.c +++ b/src/aklog/aklog.c @@ -1166,7 +1166,7 @@ next_path(char *origpath) static char path[MAXPATHLEN + 1]; static char pathtocheck[MAXPATHLEN + 1]; - int link = FALSE; /* Is this a symbolic link? */ + ssize_t link; /* Return value from readlink */ char linkbuf[MAXPATHLEN + 1]; char tmpbuf[MAXPATHLEN + 1]; @@ -1244,7 +1244,7 @@ next_path(char *origpath) else last_comp = elast_comp; } - while(link); + while(link > 0); return(pathtocheck); }