DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: "Richardson, Bruce" <bruce.richardson@intel.com>,
	Jakub Grajciar <jgrajcia@cisco.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [RFC v2] /net: memory interface (memif)
Date: Wed, 12 Dec 2018 10:19:02 +0000	[thread overview]
Message-ID: <54ae65dd-a51f-baa9-1eb2-ea0b18996c25@intel.com> (raw)
In-Reply-To: <59AF69C657FD0841A61C55336867B5B0726FADC1@IRSMSX103.ger.corp.intel.com>

On 10-Dec-18 10:50 AM, Richardson, Bruce wrote:
> 
> 
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Burakov, Anatoly
>> Sent: Monday, December 10, 2018 10:43 AM
>> To: Jakub Grajciar <jgrajcia@cisco.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [RFC v2] /net: memory interface (memif)
>>
>> On 10-Dec-18 10:06 AM, Jakub Grajciar wrote:
>>> Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
>>> ---
>>
>> As a general comment, some description/cover letter would have been nice.
>>
>>> +
>>> +	memif_msg_disconnect_t *d = &e->msg.disconnect;
>>> +
>>> +	e->msg.type = MEMIF_MSG_TYPE_DISCONNECT;
>>> +	d->code = err_code;
>>> +
>>> +	if (reason != NULL) {
>>> +		strncpy((char *)d->string, reason, strlen(reason));
>>> +		if (cc->pmd != NULL) {
>>> +			strncpy(cc->pmd->local_disc_string, reason,
>>> +				strlen(reason));
>>> +		}
>>
>> I haven't looked at the entire thing, this is just something that caught
>> my eye during quick skimming through code.
>>
>> On the face of it, this looks dangerous - you're setting the destination
>> buffer size from source buffer size. What if `d->string` is shorter than
>> `reason`?
>>
> 
> And strncpy is dangerous - use strlcpy instead.

Isn't strscpy the string copy function du jour now? :)

> 
> /Bruce
> 


-- 
Thanks,
Anatoly

  reply	other threads:[~2018-12-12 10:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10  9:14 [dpdk-dev] [PATCH v3] eal_interrupts: add option for pending callback unregister Jakub Grajciar
2018-12-10  9:42 ` [dpdk-dev] [RFC] /net: memory interface (memif) Jakub Grajciar
2018-12-10 10:06 ` [dpdk-dev] [RFC v2] " Jakub Grajciar
2018-12-10 10:42   ` Burakov, Anatoly
2018-12-10 10:50     ` Richardson, Bruce
2018-12-12 10:19       ` Burakov, Anatoly [this message]
2018-12-12 10:30         ` Bruce Richardson
2018-12-10 14:48   ` Wiles, Keith
2018-12-10 15:13     ` Wiles, Keith
2018-12-17  4:26       ` Honnappa Nagarahalli
2018-12-17  4:54         ` Honnappa Nagarahalli
2018-12-10 16:20   ` Stephen Hemminger
2018-12-11  7:39   ` Ananyev, Konstantin

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=54ae65dd-a51f-baa9-1eb2-ea0b18996c25@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jgrajcia@cisco.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).