[patch] setfiles bugfix

Yuichi Nakamura ynakam at hitachisoft.jp
Wed Sep 26 23:26:45 UTC 2007


On Thu, 27 Sep 2007 08:14:01 +0900
Yuichi Nakamura  wrote:
> Hello.
> 
> On Wed, 26 Sep 2007 18:59:15 +0100
> Denys Vlasenko  wrote:
> > On Wednesday 26 September 2007 08:44, Yuichi Nakamura wrote:
> > > 
> > > This patch fixes bug in setfiles.
> > > setfiles segfaults in p[0] = '\0'.
> > 
> > I am applying this instead:
> > 
> > diff -urN busybox-1.7.1/selinux/setfiles.c busybox-1.7.1-setfiles/selinux/setfiles.c
> > --- busybox-1.7.1/selinux/setfiles.c    2007-09-03 12:48:46.000000000 +0100
> > +++ busybox-1.7.1-setfiles/selinux/setfiles.c   2007-09-26 18:58:22.000000000 +0100
> > @@ -189,7 +189,7 @@
> >                         file_sep = strrchr(tmp_path, '/');
> >                         if (file_sep == tmp_path) {
> >                                 file_sep++;
> > -                               p[0] = '\0';
> > +                               path[0] = '\0';
> >                                 p = path;
> >                         } else if (file_sep) {
> >                                 *file_sep++ = '\0';
> >  
> > 
> > It should be shorter.
> I agree, please apply this.
I was wrong...

p should also point to path.
So, this patch does not work.
Please apply original one, below.

Index: selinux/setfiles.c
===================================================================
--- selinux/setfiles.c	(revision 20029)
+++ selinux/setfiles.c	(working copy)
@@ -189,8 +189,7 @@
 			file_sep = strrchr(tmp_path, '/');
 			if (file_sep == tmp_path) {
 				file_sep++;
-				p[0] = '\0';
-				p = path;
+				p = strcpy(path, "");
 			} else if (file_sep) {
 				*file_sep++ = '\0';
 				p = realpath(tmp_path, path);



-- 
Yuichi Nakamura
Hitachi Software Engineering Co., Ltd.
Japan SELinux Users Group(JSELUG): http://www.selinux.gr.jp/
SELinux Policy Editor: http://seedit.sourceforge.net/




More information about the busybox mailing list