trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Peach <jpe...@apache.org>
Subject Re: [trafficserver] branch master updated: Fix possibility of NULL assignment to std::string
Date Mon, 03 Oct 2016 01:22:43 GMT

> On Oct 2, 2016, at 5:36 PM, sorber@apache.org wrote:
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> sorber pushed a commit to branch master
> in repository https://git-dual.apache.org/repos/asf/trafficserver.git
> 
> The following commit(s) were added to refs/heads/master by this push:
>       new  91bfe21   Fix possibility of NULL assignment to std::string
> 91bfe21 is described below
> 
> commit 91bfe214cc2356ae19b78776815d0344d1a0906d
> Author: Phil Sorber <sorber@apache.org>
> AuthorDate: Sun Oct 2 18:18:35 2016 -0600
> 
>    Fix possibility of NULL assignment to std::string
> ---
> plugins/header_rewrite/expander.cc | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/plugins/header_rewrite/expander.cc b/plugins/header_rewrite/expander.cc
> index 22dca9c..c62a7d0 100644
> --- a/plugins/header_rewrite/expander.cc
> +++ b/plugins/header_rewrite/expander.cc
> @@ -67,7 +67,12 @@ VariableExpander::expand(const Resources &res)
>       // Protocol of the incoming request
>       if (TSHttpTxnPristineUrlGet(res.txnp, &bufp, &url_loc) == TS_SUCCESS) {
>         int len;
> -        resolved_variable = TSUrlSchemeGet(bufp, url_loc, &len);
> +        const char *tmp = TSUrlSchemeGet(bufp, url_loc, &len);
> +        if ((tmp != NULL) && (len > 0)) {
> +          resolved_variable.assign(tmp, len);
> +        } else {
> +          resolved_variable.assign("");
> +        }

FWIW every other place in this file does

if (tmp && len) {
	resolved_variable.assign(tmp, len);
}


Mime
View raw message