You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by James Peach <jp...@apache.org> on 2016/11/28 05:54:50 UTC

Re: [trafficserver] branch master updated: TS-5063: Fixes coverity warnings and cleans up the temp string

> On Nov 27, 2016, at 2:19 PM, zwoop@apache.org wrote:
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> zwoop 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  2e79b30   TS-5063: Fixes coverity warnings and cleans up the temp string
> 2e79b30 is described below
> 
> commit 2e79b300df22985cf21ef070295d0f1ea0a32b33
> Author: Leif Hedstrom <zw...@apache.org>
> AuthorDate: Wed Nov 23 14:23:00 2016 -0700
> 
>    TS-5063: Fixes coverity warnings and cleans up the temp string
> 
>    The Vec<char> seems overkill here, and makes things less nice when
>    managing the intermediary strings. The new code has issues with being
>    potentially used without initialization.
> 
>    CID 1365975, 1365974
> ---
> mgmt/LocalManager.cc | 31 +++++++++++++++----------------
> 1 file changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
> index 75652a1..e10250d 100644
> --- a/mgmt/LocalManager.cc
> +++ b/mgmt/LocalManager.cc
> @@ -858,6 +858,8 @@ LocalManager::processEventQueue()
>  *   onetime_options: one time options that traffic_server should be started with (ie
>  *                    these options do not persist across reboots)
>  */
> +static const size_t OPTIONS_SIZE = 16384; // Arbitrary max size for command line option string
> +
> bool
> LocalManager::startProxy(const char *onetime_options)
> {
> @@ -924,19 +926,18 @@ LocalManager::startProxy(const char *onetime_options)
>     int i = 0;
>     char *options[32], *last, *tok;
>     bool open_ports_p = false;
> +    char real_proxy_options[OPTIONS_SIZE];
> 
> -    Vec<char> real_proxy_options;
> -
> -    real_proxy_options.append(proxy_options, strlen(proxy_options));
> +    ink_strlcpy(real_proxy_options, proxy_options, strlen(proxy_options));


ink_strlcpy(real_proxy_options, proxy, options, OPTIONS_SIZE);