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: <20181002154513.GB9457@redhat.com>
Date:   Tue, 2 Oct 2018 12:45:13 -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>, acme@...nel.org
Subject: Re: [PATCH 1/5] perf strbuf: match va_{add,copy} with va_end

Em Tue, Oct 02, 2018 at 10:29:10AM -0400, Sanskriti Sharma escreveu:
> Ensure that all code paths in strbuf_addv() call va_end() on the
> ap_saved copy that was made.
> 
> Fixes the following coverity complaint:
> 
>   Error: VARARGS (CWE-237): [#def683]
>   tools/perf/util/strbuf.c:106: missing_va_end: va_end was not called
>   for "ap_saved".
 

Thanks, applied to perf/core

- Arnaldo

> Signed-off-by: Sanskriti Sharma <sansharm@...hat.com>
> ---
>  tools/perf/util/strbuf.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c
> index 3d1cf5b..9005fbe 100644
> --- a/tools/perf/util/strbuf.c
> +++ b/tools/perf/util/strbuf.c
> @@ -98,19 +98,25 @@ static int strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap)
>  
>  	va_copy(ap_saved, ap);
>  	len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
> -	if (len < 0)
> +	if (len < 0) {
> +		va_end(ap_saved);
>  		return len;
> +	}
>  	if (len > strbuf_avail(sb)) {
>  		ret = strbuf_grow(sb, len);
> -		if (ret)
> +		if (ret) {
> +			va_end(ap_saved);
>  			return ret;
> +		}
>  		len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved);
>  		va_end(ap_saved);
>  		if (len > strbuf_avail(sb)) {
>  			pr_debug("this should not happen, your vsnprintf is broken");
> +			va_end(ap_saved);
>  			return -EINVAL;
>  		}
>  	}
> +	va_end(ap_saved);
>  	return strbuf_setlen(sb, sb->len + len);
>  }
>  
> -- 
> 1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ