From: Greg KH <gregkh@linuxfoundation.org>
To: SIMRAN SINGHAL <singhalsimran0@gmail.com>
Cc: devel@driverdev.osuosl.org, outreachy-kernel@googlegroups.com,
arve@android.com, riandrews@android.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] staging: android: Replace strcpy with strlcpy
Date: Sun, 12 Mar 2017 16:04:21 +0100 [thread overview]
Message-ID: <20170312150421.GA24990@kroah.com> (raw)
In-Reply-To: <CALrZqyP=eMdcFQvM+ZvGiyrcSdnYJxiyOkmr5H6GyEG9qo-ggQ@mail.gmail.com>
On Sun, Mar 12, 2017 at 08:25:28PM +0530, SIMRAN SINGHAL wrote:
> On Sun, Mar 12, 2017 at 7:04 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Sun, Mar 12, 2017 at 03:32:44AM +0530, simran singhal wrote:
> >> Replace strcpy with strlcpy as strcpy does not check for buffer
> >> overflow.
> >
> > Can there be a buffer overflow here? If not, then strcpy is just fine
> > to use. Do you see a potential code path here that actually is a
> > problem using this?
> >
> >> This is found using Flawfinder.
> >
> > You mean 'grep'? :)
> >
> > If not, what exactly does "Flawfinder" point out is wrong with the code
> > here? At first glance, I can't find it, but perhaps the tool, and your
> > audit, provided more information?
> >
> > thanks,
> >
>
> Flawfinder reports possible security weaknesses (“flaws”) sorted by risk level.
> The risk level is shown inside square brackets and varies from 0, very
> little risk,
> to 5, great risk.
>
> So, here in this case I was getting risk of [4].
> This is what I got:
> drivers/staging/android/ashmem.c:551: [4] (buffer) strcpy:
> Does not check for buffer overflows when copying to destination (CWE-120).
> Consider using strcpy_s, strncpy, or strlcpy (warning, strncpy is easily
> misused).
Consider looking at the code to see if it actually is incorrect before
blindly accepting random comments by a random tool :)
Again, if you can see how this is incorrect, great, let's fix it,
otherwise please leave it as-is because so far your fixes are actually
breaking things :(
thanks,
greg k-h
prev parent reply other threads:[~2017-03-12 15:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-11 22:02 [PATCH v3] staging: android: Replace strcpy with strlcpy simran singhal
2017-03-12 13:34 ` Greg KH
2017-03-12 14:55 ` SIMRAN SINGHAL
2017-03-12 15:04 ` Greg KH [this message]
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=20170312150421.GA24990@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arve@android.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=riandrews@android.com \
--cc=singhalsimran0@gmail.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