connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Santtu Lakkala <santtu.lakkala@jolla.com>
To: "Lukáš Karas" <lukas.karas@centrum.cz>, connman@lists.linux.dev
Subject: Re: [PATCH] dnsproxy: Suppress GCC warning stringop-overflow
Date: Tue, 15 Jun 2021 12:15:13 +0300	[thread overview]
Message-ID: <71ce6b97-7f8c-1f0b-4497-41036acd05bd@jolla.com> (raw)
In-Reply-To: <2664831.oeSPPojSJB@latitudemachine>

On 15.6.2021 10.40, Lukáš Karas wrote:
> Recently added check for buffer size breaks build
> with GCC 10.3.0, its internal analysis suspect that code
> is not correct. Build fails with error:
> 
>    '__builtin_strncpy' specified bound depends on the length
>    of the source argument [-Werror=stringop-overflow=]
> 
> on src/dnsproxy.c:1794
> 
> I not sure if suppressing compiler warning is a good practice
> in Connman, but it fixes build for me :-)

I would say replacing the strncpy call with a memcpy call would be a 
better approach. Since all the checks have already been done before the 
call there's no functional difference, but the compiler wouldn't need to 
complain about the logic (while from security PoV there's no issue, the 
warning from the compiler has certain merit).

-- 
Santtu

  reply	other threads:[~2021-06-15  9:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15  7:40 [PATCH] dnsproxy: Suppress GCC warning stringop-overflow Lukáš Karas
2021-06-15  9:15 ` Santtu Lakkala [this message]
2021-06-15  9:51 VAUTRIN Emmanuel (Canal Plus Prestataire)

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=71ce6b97-7f8c-1f0b-4497-41036acd05bd@jolla.com \
    --to=santtu.lakkala@jolla.com \
    --cc=connman@lists.linux.dev \
    --cc=lukas.karas@centrum.cz \
    /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).