[igt-dev] [PATCH i-g-t 2/3] runner/resultgen: Don't pass NULL to str*() functions

Petri Latvala petri.latvala at intel.com
Thu Jun 20 12:33:51 UTC 2019


On Thu, Jun 20, 2019 at 03:29:01PM +0300, Arkadiusz Hiler wrote:
> If we don't get values from the JSON strlen() and strcmp() on them would
> dereference NULL pointer.
> 
> Cc: Petri Latvala <petri.latvala at intel.com>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>


Reviewed-by: Petri Latvala <petri.latvala at intel.com>


> ---
>  runner/resultgen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/runner/resultgen.c b/runner/resultgen.c
> index 7b4cd519..58b95220 100644
> --- a/runner/resultgen.c
> +++ b/runner/resultgen.c
> @@ -866,7 +866,7 @@ static void fill_from_journal(int fd,
>  
>  static void override_result_single(struct json_object *obj)
>  {
> -	const char *errtext = NULL, *result = NULL;
> +	const char *errtext = "", *result = "";
>  	struct json_object *textobj;
>  	bool dmesgwarns = false;
>  
> -- 
> 2.21.0
> 


More information about the igt-dev mailing list