From: Elliott Mitchell <ehem+xen@m5p.com>
To: Marek Marczykowski-G??recki <marmarek@invisiblethingslab.com>
Cc: xen-devel@lists.xenproject.org,
Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wl@xen.org>,
Anthony PERARD <anthony.perard@citrix.com>
Subject: Re: [PATCH 2/2] libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
Date: Tue, 18 Aug 2020 20:43:56 -0700 [thread overview]
Message-ID: <20200819034356.GA29116@mattapan.m5p.com> (raw)
In-Reply-To: <20200819020036.599065-2-marmarek@invisiblethingslab.com>
On Wed, Aug 19, 2020 at 04:00:36AM +0200, Marek Marczykowski-G??recki wrote:
> diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
> index f360f5e228..b039143b8a 100644
> --- a/tools/libxl/libxl_utils.c
> +++ b/tools/libxl/libxl_utils.c
> }
> memset(un, 0, sizeof(struct sockaddr_un));
> un->sun_family = AF_UNIX;
> - strncpy(un->sun_path, path, sizeof(un->sun_path));
> + strncpy(un->sun_path, path, sizeof(un->sun_path) - 1);
> return 0;
> }
While the earlier lines are okay, this line introduces an error. If the
compiler complains once the earlier lines are fixed, something might need
to be done about this.
I would be tempted to switch to strlcpy() since this doesn't look like it
needs un->sun_path to be zeroed out. (note I'm not familiar with this
code, so someone else needs to check me on this)
--
(\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/)
\BS ( | ehem+sigmsg@m5p.com PGP 87145445 | ) /
\_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
next prev parent reply other threads:[~2020-08-19 3:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-19 2:00 [PATCH 1/2] libxl: workaround gcc 10.2 maybe-uninitialized warning Marek Marczykowski-Górecki
2020-08-19 2:00 ` [PATCH 2/2] libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un Marek Marczykowski-Górecki
2020-08-19 3:43 ` Elliott Mitchell [this message]
2020-08-19 9:41 ` Marek Marczykowski-G??recki
2020-08-19 10:30 ` Ian Jackson
2020-08-19 10:51 ` Marek Marczykowski-G??recki
2020-08-19 17:00 ` Elliott Mitchell
2020-08-19 10:31 ` [PATCH 1/2] libxl: workaround gcc 10.2 maybe-uninitialized warning Ian Jackson
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=20200819034356.GA29116@mattapan.m5p.com \
--to=ehem+xen@m5p.com \
--cc=anthony.perard@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=marmarek@invisiblethingslab.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/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).