[patch] setfiles bugfix
Yuichi Nakamura
ynakam at hitachisoft.jp
Thu Sep 27 23:22:35 UTC 2007
On Thu, 27 Sep 2007 12:19:21 +0100
Denys Vlasenko wrote:
> On Thursday 27 September 2007 00:26, Yuichi Nakamura wrote:
> > > > 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.
>
> It is. There is "p = path;"
>
> > So, this patch does not work.
> > Please apply original one, below.
>
> > file_sep++;
> > - p[0] = '\0';
> > - p = path;
> > + p = strcpy(path, "");
>
> "store NUL in path[0], then copy path to p".
>
> It is equivalent to: path[0] = '\0'; p = path;
> --
> vda
I checked svn and found p[0] = '\0'; p=path.
Index: selinux/setfiles.c
===================================================================
--- selinux/setfiles.c (revision 20076)
+++ selinux/setfiles.c (working copy)
@@ -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';
Regards,
--
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