Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: new warning in make
To:
George Koehler <kernigh@gmail.com>
Cc:
Marc Espie <marc.espie.openbsd@gmail.com>, millert@openbsd.org, tech@openbsd.org
Date:
Fri, 26 Sep 2025 11:16:58 +0200

Download raw body.

Thread
On Fri, Sep 26, 2025 at 12:55:59AM -0400, George Koehler wrote:
> On Thu, 25 Sep 2025 11:35:28 +0200
> Marc Espie <marc.espie.openbsd@gmail.com> wrote:
> 
> > cc now warns over arch.c
> > /usr/src/usr.bin/make/arch.c:839:3: warning: 'snprintf' will always be truncated; specified size is 12, but format string expands to at least 13 [-Wformat-truncation]
> >   839 |                 snprintf(arHeader.ar_date, sizeof(arHeader.ar_date),
> >       |                 ^
> > 
> > 
> > Pretty sure it's correct, considering that snprintf will truncate with a 0.
> > 
> > Printing to a temp buffer and copying only the string ought to fix it
> > if I'm not mistaken.
> 
> Your diff is correct, but while we are here, I wonder if it should be
> "%-12lld" and (long long)time(NULL)?
> 
> (Minor detail: maybe add an empty line under "char temp".)

ok for the version with these two changes.