From 50c5f3789cc61de7ddbfe07922027b6464caa4ae Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 30 Sep 2014 13:52:31 -0400 Subject: [PATCH] aklog: Fix segfault on aklog -path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 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 (cherry picked from commit fbea3265b3bc042b97be17229839ccf7d11a0bf9) Change-Id: I6eb0126c574665507be923102c3fa812c3716352 Reviewed-on: http://gerrit.openafs.org/11530 Tested-by: Anders Kaseorg Reviewed-by: Anders Kaseorg Reviewed-by: Stephan Wiesand Tested-by: Stephan Wiesand --- src/aklog/aklog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aklog/aklog.c b/src/aklog/aklog.c index 7782b0c9c..a09534048 100644 --- a/src/aklog/aklog.c +++ b/src/aklog/aklog.c @@ -1176,7 +1176,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]; @@ -1254,7 +1254,7 @@ next_path(char *origpath) else last_comp = elast_comp; } - while(link); + while(link > 0); return(pathtocheck); } -- 2.39.5