[lxc-devel] [PATCH] fortify: use reentrant safe strtok_r

Serge Hallyn serge.hallyn at ubuntu.com
Tue Apr 16 02:43:32 UTC 2013


Quoting Dwight Engen (dwight.engen at oracle.com):
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/lxc/conf.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index c416da5..917c052 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -750,7 +750,7 @@ static int setup_tty(const struct lxc_rootfs *rootfs,
>  static int setup_rootfs_pivot_root_cb(char *buffer, void *data)
>  {
>  	struct lxc_list	*mountlist, *listentry, *iterator;
> -	char *pivotdir, *mountpoint, *mountentry;
> +	char *pivotdir, *mountpoint, *mountentry, *saveptr;
>  	int found;
>  	void **cbparm;
>  
> @@ -761,12 +761,12 @@ static int setup_rootfs_pivot_root_cb(char *buffer, void *data)
>  	pivotdir  = cbparm[1];
>  
>  	/* parse entry, first field is mountname, ignore */
> -	mountpoint = strtok(mountentry, " ");
> +	mountpoint = strtok_r(mountentry, " ", &saveptr);
>  	if (!mountpoint)
>  		return -1;
>  
>  	/* second field is mountpoint */
> -	mountpoint = strtok(NULL, " ");
> +	mountpoint = strtok_r(NULL, " ", &saveptr);
>  	if (!mountpoint)
>  		return -1;
>  
> -- 
> 1.7.12.3
> 
> 
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list