Re: [PATCH] weston-launch: Fix failure to exec weston due to initalized argv values

2013-05-22 Thread Kristian Høgsberg
On Wed, May 22, 2013 at 10:55:33PM +0300, Ander Conselvan de Oliveira wrote:
> From: Ander Conselvan de Oliveira 
> 
> The array of arguments supplied to execv must be NULL terminated. If
> unitialized values are used as pointers the exec call may fail with a
> EFAULT error ("Bad address").

Thanks Ander, I missed that when I reviewed the patch.

Kristian

> https://bugs.freedesktop.org/show_bug.cgi?id=64874
> ---
>  src/weston-launch.c |5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/weston-launch.c b/src/weston-launch.c
> index 42b2506..ad77476 100644
> --- a/src/weston-launch.c
> +++ b/src/weston-launch.c
> @@ -570,7 +570,7 @@ main(int argc, char *argv[])
>   }
>   }
>  
> - if ((argc - optind) > (MAX_ARGV_SIZE - 5))
> + if ((argc - optind) > (MAX_ARGV_SIZE - 6))
>   error(1, E2BIG, "Too many arguments to pass to weston");
>  
>   if (new_user)
> @@ -586,7 +586,8 @@ main(int argc, char *argv[])
>   child_argv[3] = BINDIR "/weston \"$@\"";
>   child_argv[4] = "weston";
>   for (i = 0; i < (argc - optind); ++i)
> - child_argv[5+i] = argv[optind+i];
> + child_argv[5 + i] = argv[optind + i];
> + child_argv[5 + i] = NULL;
>  
>   term = getenv("TERM");
>   clearenv();
> -- 
> 1.7.9.5
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH] weston-launch: Fix failure to exec weston due to initalized argv values

2013-05-22 Thread Ander Conselvan de Oliveira
From: Ander Conselvan de Oliveira 

The array of arguments supplied to execv must be NULL terminated. If
unitialized values are used as pointers the exec call may fail with a
EFAULT error ("Bad address").

https://bugs.freedesktop.org/show_bug.cgi?id=64874
---
 src/weston-launch.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/weston-launch.c b/src/weston-launch.c
index 42b2506..ad77476 100644
--- a/src/weston-launch.c
+++ b/src/weston-launch.c
@@ -570,7 +570,7 @@ main(int argc, char *argv[])
}
}
 
-   if ((argc - optind) > (MAX_ARGV_SIZE - 5))
+   if ((argc - optind) > (MAX_ARGV_SIZE - 6))
error(1, E2BIG, "Too many arguments to pass to weston");
 
if (new_user)
@@ -586,7 +586,8 @@ main(int argc, char *argv[])
child_argv[3] = BINDIR "/weston \"$@\"";
child_argv[4] = "weston";
for (i = 0; i < (argc - optind); ++i)
-   child_argv[5+i] = argv[optind+i];
+   child_argv[5 + i] = argv[optind + i];
+   child_argv[5 + i] = NULL;
 
term = getenv("TERM");
clearenv();
-- 
1.7.9.5

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel