On Mon, 30 Sep 2013 14:41:41 -0500
Serge Hallyn <serge.hal...@ubuntu.com> wrote:

> Quoting Dwight Engen (dwight.en...@oracle.com):
> > - When doing the selinux change, I noticed that there was a lot of
> >   duplication of code in handing string configuration items, so I
> >   refactored this into a common function.
> > 
> > - Added a config_string_max that can be passed a maximum acceptable
> >   length, used to limit ttydir to NAME_MAX.
> > 
> > - The behavior of config_seccomp was different than other strings:
> > if the item was already defined, then the second attempt to set it
> > would fail instead of just replacing the value. Changed to just
> > replace the value.
> > 
> > - Remove unused key and lxc_conf arguments to config_path_item().
> > 
> > Signed-off-by: Dwight Engen <dwight.en...@oracle.com>
> 
> Hi,
> 
> very nice cleanup, thanks.
> 
> Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com>
> 
> Just one question:
> 
> 
> > @@ -938,21 +937,7 @@ static int config_tty(const char *key, const
> > char *value, static int config_ttydir(const char *key, const char
> > *value, struct lxc_conf *lxc_conf)
> >  {
> > -   char *path;
> > -
> > -   if (!value || strlen(value) == 0)
> > -           return 0;
> > -   path = strdup(value);
> > -   if (!path) {
> > -           SYSERROR("failed to strdup '%s': %m", value);
> > -           return -1;
> > -   }
> > -
> > -   if (lxc_conf->ttydir)
> > -           free(lxc_conf->ttydir);
> > -   lxc_conf->ttydir = path;
> > -
> > -   return 0;
> > +   return config_string_item_max(&lxc_conf->ttydir, value,
> > NAME_MAX+1);
> 
> Hi,
> 
> why the NAME_MAX limit here?

Because if we let them put in a ttydir bigger than NAME_MAX, then the
call to mkdir() in setup_ttydir_console() is just going to fail with
ENAMETOOLONG anyways. 

> -serge


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to