[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] pci-arbiter: Fix a -Wstringop-truncation warning
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 3/4] pci-arbiter: Fix a -Wstringop-truncation warning |
Date: |
Sun, 3 Nov 2019 17:47:03 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
James Clarke, le dim. 03 nov. 2019 16:38:50 +0000, a ecrit:
> On 3 Nov 2019, at 16:20, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> > Joan Lledó via Bug reports for the GNU Hurd, le dim. 03 nov. 2019
> > 10:38:28 +0100, a ecrit:
> >> @@ -206,7 +208,7 @@ create_fs_tree (struct pcifs * fs)
> >> e_stat = list->stat;
> >> e_stat.st_mode &= ~S_IROOT; /* Remove the root mode */
> >> memset (entry_name, 0, NAME_SIZE);
> >> - snprintf (entry_name, NAME_SIZE, "%04x", device->domain);
> >> + snprintf (entry_name, NAME_SIZE - 1, "%04x", device->domain);
> >
> > Perhaps replace the whole memset with just setting
> > entry_name[NAME_SIZE-1] = 0
> > ? and ditto below.
>
> snprintf guarantees NUL termination, so this now over-truncates.
Ah, indeed. I reverted the snprintf ones. The memset still seems
spurious to me, isn't it?
Samuel
- Re: [PATCH] pci-arbiter: Remove embedded pciaccess code, Joan Lledó, 2019/11/03
- Re: [PATCH] pci-arbiter: Remove embedded pciaccess code, Joan Lledó, 2019/11/03
- [PATCH 2/4] pci-arbiter: Call libpciaccess cleanup on shutdown, Joan Lledó, 2019/11/03
- [PATCH 4/4] pci-arbiter: Fix warning on passing incompatible pointer type, Joan Lledó, 2019/11/03
- [PATCH 3/4] pci-arbiter: Fix a -Wstringop-truncation warning, Joan Lledó, 2019/11/03
- Re: [PATCH 3/4] pci-arbiter: Fix a -Wstringop-truncation warning, Samuel Thibault, 2019/11/03
- Re: [PATCH 3/4] pci-arbiter: Fix a -Wstringop-truncation warning, James Clarke, 2019/11/03
- Re: [PATCH 3/4] pci-arbiter: Fix a -Wstringop-truncation warning,
Samuel Thibault <=
- Re: [PATCH 3/4] pci-arbiter: Fix a -Wstringop-truncation warning, Joan Lledó, 2019/11/09
- [PATCH] pci-arbiter: Remove spurious memset(), Joan Lledó, 2019/11/09
- Re: [PATCH] pci-arbiter: Remove spurious memset(), Samuel Thibault, 2019/11/09
[PATCH 1/4] pci-arbiter: Remove embedded pciaccess code, Joan Lledó, 2019/11/03
Re: [PATCH] pci-arbiter: Remove embedded pciaccess code, Samuel Thibault, 2019/11/03