[Piglit] [PATCH] glx-string-sanity: Fix string length miscalculation.

Brian Paul brian.e.paul at gmail.com
Sat Dec 1 17:19:55 PST 2012


On Sat, Dec 1, 2012 at 11:57 AM, Vinson Lee <vlee at freedesktop.org> wrote:
> Reported by Coverity Scan.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/glx/glx-string-sanity.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/glx/glx-string-sanity.c b/tests/glx/glx-string-sanity.c
> index bc66665..1711d23 100644
> --- a/tests/glx/glx-string-sanity.c
> +++ b/tests/glx/glx-string-sanity.c
> @@ -135,7 +135,7 @@ main(int argc, char **argv)
>          * valid for a string to not be in the server string when it is listed
>          * in the unified string.
>          */
> -       buf = malloc(strlen(server_string + 1));
> +       buf = malloc(strlen(server_string) + 1);
>         while (*server_string != '\0') {
>                 const char *client;
>                 const char *end;

This would probably never be a problem in practice, but good to fix.

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the Piglit mailing list