From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Gaetan Rivet <gaetan.rivet@6wind.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] eal: add strscpy function
Date: Wed, 12 Sep 2018 14:29:13 +0100 [thread overview]
Message-ID: <992ccee1-45c3-08d4-e743-b7490495c1e5@intel.com> (raw)
In-Reply-To: <20180911150049.14755-1-gaetan.rivet@6wind.com>
On 9/11/2018 4:00 PM, Gaetan Rivet wrote:
> The strncpy function has long been deemed unsafe for use,
> in favor of strlcpy or snprintf.
>
> While snprintf is standard and strlcpy is still largely available,
> they both have issues regarding error checking and performance.
>
> Both will force reading the source buffer past the requested size
> if the input is not a proper c-string, and will return the expected
> number of bytes copied, meaning that error checking needs to verify
> that the number of bytes copied is not superior to the destination
> size.
>
> This contributes to awkward code flow, unclear error checking and
> potential issues with malformed input.
>
> The function strscpy has been discussed for some time already and
> has been made available in the linux kernel[1].
>
> Propose this new function as a safe alternative.
>
> [1]: http://git.kernel.org/linus/30c44659f4a3
>
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> Acked-by: Juhamatti Kuusisaari <juhamatti.kuusisaari@coriant.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
next prev parent reply other threads:[~2018-09-12 13:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-11 5:33 [dpdk-dev] strscpy() support to DPDK? Kuusisaari, Juhamatti (Coriant - FI/Espoo)
2018-09-11 10:04 ` [dpdk-dev] [PATCH v1] eal: add strscpy function Gaetan Rivet
2018-09-11 10:17 ` Kuusisaari, Juhamatti (Coriant - FI/Espoo)
2018-09-11 15:00 ` [dpdk-dev] [PATCH v2] " Gaetan Rivet
2018-09-12 13:29 ` Ferruh Yigit [this message]
2018-09-19 9:41 ` 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=992ccee1-45c3-08d4-e743-b7490495c1e5@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=gaetan.rivet@6wind.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).