RE: [PATCH v2] libselinux: clean up process file

2016-09-08 Thread Roberts, William C
> > > +static FILE *open_file(const char *path, const char *suffix, > > > +char *save_path, size_t len, struct stat *sb) { > > > + unsigned i; > > > + int rc; > > > + char stack_path[len]; > > > > Ew, what is this? C99 magic. Probably just make it PATH_MAX and be > > done with it. > >

RE: [PATCH v2] libselinux: clean up process file

2016-09-08 Thread Roberts, William C
> -Original Message- > From: Stephen Smalley [mailto:s...@tycho.nsa.gov] > Sent: Thursday, September 8, 2016 12:41 PM > To: Roberts, William C <william.c.robe...@intel.com>; selinux@tycho.nsa.gov; > seandroid-l...@tycho.nsa.gov; jwca...@tycho.nsa.gov > Subject: R

Re: [PATCH v2] libselinux: clean up process file

2016-09-08 Thread Stephen Smalley
On 09/08/2016 03:30 PM, Roberts, William C wrote: > > + /* Append any given suffix */ + char *to = stpcpy([current_size], "."); >>> >>> Simpler as: >>> char *to = current + current_size; >>> *to++ = '.'; >> >> I don't think this is simpler, but I'll do it. > > Doing that as

RE: [PATCH v2] libselinux: clean up process file

2016-09-08 Thread Roberts, William C
> > > + /* Append any given suffix */ > > > + char *to = stpcpy([current_size], "."); > > > > Simpler as: > > char *to = current + current_size; > > *to++ = '.'; > > I don't think this is simpler, but I'll do it. Doing that as is gets us this: ==26050== Conditional jump or move depends

RE: [PATCH v2] libselinux: clean up process file

2016-09-08 Thread Roberts, William C
> -Original Message- > From: Stephen Smalley [mailto:s...@tycho.nsa.gov] > Sent: Thursday, September 8, 2016 8:15 AM > To: Roberts, William C <william.c.robe...@intel.com>; selinux@tycho.nsa.gov; > seandroid-l...@tycho.nsa.gov; jwca...@tycho.nsa.gov > Subject: R

Re: [PATCH v2] libselinux: clean up process file

2016-09-08 Thread Stephen Smalley
On 09/06/2016 08:07 PM, william.c.robe...@intel.com wrote: > From: William Roberts > > The current process_file() code will open the file > twice on the case of a binary file, correct this. > > The general flow through process_file() was a bit > difficult to read,