From: <ssm...@us...> - 2006-09-01 19:20:54
|
Revision: 2010 http://svn.sourceforge.net/selinux/?rev=2010&view=rev Author: ssmalley Date: 2006-09-01 12:20:50 -0700 (Fri, 01 Sep 2006) Log Message: ----------- Author: Erich Schubert Email: er...@de... Subject: Bug in restorecon for symlinks in root dir Date: Wed, 30 Aug 2006 15:23:00 +0200 How about this fix for correct handling of //lib64 etc.? In contrast to my previous mail, the "len == 0" part in the if statement should be necessary (for the /lib64 case; since path="" in that situation) The "len == 0" test is only unneeded if we used my initial patch (with strcpy("/", path)); since the len == 0 case should then never occur. The patch is straightforward - it only adds / to the path if it doesn't end in a slash yet. Since this will result in path names at most 1 char shorter than before, the buffer size check doesn't need to be modified (though it wastes one character then) Acked-by: Stephen Smalley <sd...@ty...> Acked-by: Joshua Brindle <jbr...@tr...> Modified Paths: -------------- trunk/policycoreutils/restorecon/restorecon.c Modified: trunk/policycoreutils/restorecon/restorecon.c =================================================================== --- trunk/policycoreutils/restorecon/restorecon.c 2006-08-30 13:29:02 UTC (rev 2009) +++ trunk/policycoreutils/restorecon/restorecon.c 2006-09-01 19:20:50 UTC (rev 2010) @@ -197,8 +197,11 @@ return 1; } p += len; - *p = '/'; - p++; + /* ensure trailing slash of directory name */ + if (len == 0 || *(p - 1) != '/') { + *p = '/'; + p++; + } strcpy(p, file_sep); filename = path; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |