On Tue, Mar 03, 2015 at 04:12:56PM -0800, Matt Turner wrote:
> When built with Gentoo's package manager, the Mesa source directory
> exists seven directories deep. The path to the .test file is too long
> and is silently truncated, leading to a crash. Just use PATH_MAX.
> 
> Cc: 10.4, 10.5 <mesa-sta...@lists.freedesktop.org>
> Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=540970

Both patches:

Reviewed-by: Tom Stellard <thomas.stell...@amd.com>

Thanks!

> ---
>  src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c 
> b/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c
> index 7c9d177..422bdb0 100644
> --- a/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c
> +++ b/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c
> @@ -28,6 +28,7 @@
>   */
>  
>  #include <errno.h>
> +#include <limits.h>
>  #include <regex.h>
>  #include <stdlib.h>
>  #include <stdio.h>
> @@ -528,7 +529,6 @@ void init_compiler(
>  }
>  
>  #define MAX_LINE_LENGTH 100
> -#define MAX_PATH_LENGTH 100
>  
>  unsigned load_program(
>       struct radeon_compiler *c,
> @@ -536,14 +536,14 @@ unsigned load_program(
>       const char *filename)
>  {
>       char line[MAX_LINE_LENGTH];
> -     char path[MAX_PATH_LENGTH];
> +     char path[PATH_MAX];
>       FILE *file;
>       unsigned *count;
>       char **string_store;
>       unsigned i = 0;
>  
>       memset(line, 0, sizeof(line));
> -     snprintf(path, MAX_PATH_LENGTH, TEST_PATH "/%s", filename);
> +     snprintf(path, PATH_MAX, TEST_PATH "/%s", filename);
>       file = fopen(path, "r");
>       if (!file) {
>               return 0;
> -- 
> 2.0.5
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to