lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181002155026.GF9457@redhat.com>
Date:   Tue, 2 Oct 2018 12:50:26 -0300
From:   Arnaldo Carvalho de Melo <acme@...hat.com>
To:     Sanskriti Sharma <sansharm@...hat.com>
Cc:     linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...hat.com>,
        Joe Lawrence <joe.lawrence@...hat.com>
Subject: Re: [PATCH 5/5] perf tools: free temporary 'sys' string in
 read_event_files()

Em Tue, Oct 02, 2018 at 10:29:14AM -0400, Sanskriti Sharma escreveu:
> For each system in a given pevent, read_event_files() reads in a
> temporary 'sys' string.  Be sure to free this string before moving onto
> to the next system and/or leaving read_event_files().
> 
> Fixes the following coverity complaints:
> 
>   Error: RESOURCE_LEAK (CWE-772):
> 
>   tools/perf/util/trace-event-read.c:343: overwrite_var: Overwriting
>   "sys" in "sys = read_string()" leaks the storage that "sys" points to.
> 
>   tools/perf/util/trace-event-read.c:353: leaked_storage: Variable "sys"
>   going out of scope leaks the storage it points to.

Thanks, applied.

- Arnaldo
 
> Signed-off-by: Sanskriti Sharma <sansharm@...hat.com>
> ---
>  tools/perf/util/trace-event-read.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
> index 6a0d0f2..dd045fd 100644
> --- a/tools/perf/util/trace-event-read.c
> +++ b/tools/perf/util/trace-event-read.c
> @@ -347,9 +347,12 @@ static int read_event_files(struct tep_handle *pevent)
>  		for (x=0; x < count; x++) {
>  			size = read8(pevent);
>  			ret = read_event_file(pevent, sys, size);
> -			if (ret)
> +			if (ret) {
> +				free(sys);
>  				return ret;
> +			}
>  		}
> +		free(sys);
>  	}
>  	return 0;
>  }
> -- 
> 1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ