On Tue 21-06-11 14:10:28, Ivana Hutarova Varekova wrote:
> In some special situations in wrapper.c
> the strncpy strings can be copy in such a way there will not be the 
> termination sign in the given space thus the string will remain unterminated.
> This patch adds the termination characters
> 
> Signed-off-by: Ivana Hutarova Varekova <varek...@redhat.com>
> ---
> 
>  src/wrapper.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/src/wrapper.c b/src/wrapper.c
> index 90c8bc3..ec87584 100644
> --- a/src/wrapper.c
> +++ b/src/wrapper.c
> @@ -44,6 +44,7 @@ struct cgroup *cgroup_new_cgroup(const char *name)
>  
>       init_cgroup(cgroup);
>       strncpy(cgroup->name, name, sizeof(cgroup->name));
> +     cgroup->name[sizeof(cgroup->name) - 1] = '\0';

[This applies to the whole patch.]
OK but this means that the group name will be cut to FILENAME_MAX.
Wouldn't it be better to return with an error instead? Shorter name
might be surprising for caller.

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to