From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Fan Zhang <roy.fan.zhang@intel.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] examples/ipsec-secgw: fix copy into fixed size buffer issue
Date: Fri, 4 Nov 2016 14:15:40 +0000 [thread overview]
Message-ID: <65ef8356-b5d9-4ce2-b16c-ba09f3ccfedc@intel.com> (raw)
In-Reply-To: <1478175163-229116-3-git-send-email-roy.fan.zhang@intel.com>
On 11/3/2016 12:12 PM, Fan Zhang wrote:
> Coverity issue: 137875
> Fixes: 0d547ed0 ("examples/ipsec-secgw: support configuration
> file")
>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
> examples/ipsec-secgw/sa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
> index 9e2c8a9..c891be2 100644
> --- a/examples/ipsec-secgw/sa.c
> +++ b/examples/ipsec-secgw/sa.c
> @@ -177,7 +177,7 @@ parse_key_string(const char *key_str, uint8_t *key)
> pt_end = strchr(pt_start, ':');
>
> if (pt_end == NULL)
> - strncpy(sub_str, pt_start, strlen(pt_start));
> + strncpy(sub_str, pt_start, strlen(sub_str) - 1);
sub_str initial value is not known, "strlen(sub_str) - 1" leaves last
byte of the string random, instead of intended NULL.
Also sub_str has hardcoded length of 3, it can be good to confirm NULL
terminated byte taken into account, and number actually can be maximum
two digits long.
> else {
> if (pt_end - pt_start > 2)
> return 0;
>
next prev parent reply other threads:[~2016-11-04 14:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 12:12 [dpdk-dev] [PATCH] examples/ipsec-secgw: fix buffer not null terminated Fan Zhang
2016-11-03 12:12 ` [dpdk-dev] [PATCH] examples/ipsec-secgw: fix buffer not terminated issue Fan Zhang
2016-11-04 14:16 ` Ferruh Yigit
2016-11-06 23:38 ` Thomas Monjalon
2016-11-03 12:12 ` [dpdk-dev] [PATCH] examples/ipsec-secgw: fix copy into fixed size buffer issue Fan Zhang
2016-11-04 14:15 ` Ferruh Yigit [this message]
2016-11-07 14:21 ` [dpdk-dev] [PATCH v2] " Fan Zhang
2016-11-07 15:59 ` Ferruh Yigit
2016-11-07 20:40 ` Thomas Monjalon
2016-11-03 12:12 ` [dpdk-dev] [PATCH] examples/ipsec-secgw: fix pointer to local outside scope Fan Zhang
2016-11-04 14:15 ` Ferruh Yigit
2016-11-07 14:22 ` [dpdk-dev] [PATCH v2] " Fan Zhang
2016-11-07 17:25 ` [dpdk-dev] [PATCH v3] " Fan Zhang
2016-11-07 17:31 ` Ferruh Yigit
2016-11-07 20:48 ` Thomas Monjalon
2016-11-04 14:18 ` [dpdk-dev] [PATCH] examples/ipsec-secgw: fix buffer not null terminated Ferruh Yigit
2016-11-06 23:38 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65ef8356-b5d9-4ce2-b16c-ba09f3ccfedc@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=roy.fan.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).