From: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
To: "Tobin C. Harding" <me@tobin.cc>, greybus-dev@lists.linaro.org
Cc: devel@driverdev.osuosl.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Johan Hovold <johan@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] greybus: fw-management: Replace strncpy with strlcpy
Date: Wed, 15 Feb 2017 11:53:57 +0000 [thread overview]
Message-ID: <fbfce029-7d26-75aa-2c91-cea2442922bc@nexus-software.ie> (raw)
In-Reply-To: <1487117364-15423-1-git-send-email-me@tobin.cc>
On 15/02/17 00:09, Tobin C. Harding wrote:
> Greybus currently uses strncpy() coupled with a check for '\0' on the
> last byte of various buffers. strncpy() is passed size parameter equal
> to the size of the buffer in all instances. If the source string is
> larger than the destination buffer the check catches this and, after
> logging the error, returns an error value. In one instance the
> immediate return is not required. Using strncpy() with the manual check
> adds code that could be removed by the use of strlcpy(), although truncation
> then needs to be checked.
>
> Replace calls to strncpy() with calls to strlcpy(). Replace null
> termination checks with checks for truncated string. Add log message
> if string is truncated but do not return an error code.
The strlcpy() replace should be one patch.
The not returning on truncation should be a separate patch.
Personally I don't think the flow should change re: returning errors on
string truncation but, either way you should split it up.
---
bod
next prev parent reply other threads:[~2017-02-15 11:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 0:09 Tobin C. Harding
2017-02-15 11:53 ` Bryan O'Donoghue [this message]
2017-02-16 4:03 ` Viresh Kumar
2017-02-21 8:29 ` Tobin Harding
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=fbfce029-7d26-75aa-2c91-cea2442922bc@nexus-software.ie \
--to=pure.logic@nexus-software.ie \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=me@tobin.cc \
/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
all inboxes | Powered by JetHome®