bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Format-string mismatch in utils.c


From: Tim Ruehsen
Subject: Re: [Bug-wget] Format-string mismatch in utils.c
Date: Sat, 27 Jan 2018 10:15:00 +0100

Am Samstag, den 27.01.2018, 02:02 -0500 schrieb Mike Frysinger:
> On 22 Dec 2017 00:38, Daniel Macks wrote:
> > Building wget-1.19.2 on OS X 10.13, I get:
> > 
> > gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC=\"/sw/etc/wgetrc\"
> > -DLOCALEDIR=\"/sw/share/locale\" -I.  -I../lib -I../lib
> > -I/sw/include  -I/sw/include -I/sw/include -I/sw/include
> > -I/sw/include -DNDEBUG  -MT utils.o -MD -MP -MF .deps/utils.Tpo -c
> > -o utils.o utils.c
> > utils.c:2822:24: warning: format specifies type 'int' but the
> > argument has type 'unsigned long' [-Wformat]
> >                        (strlen (begin_pos + 8) * 3) / 4,
> > SHA256_DIGEST_SIZE,
> >                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > The actual code (a diagnostic about a wrong size:) is:
> >             logprintf (LOG_VERBOSE, _ ("Skipping key with wrong
> > size (%d/%d): %s\n"),                   
> >                        (strlen (begin_pos + 8) * 3) / 4,
> > SHA256_DIGEST_SIZE,                            
> >                        quote (begin_pos +
> > 8));                                                          
> > 
> > where strlen() returns a size_t. Changing the format-string from
> > (%d/%d) to (%lu/%d) solves it for me.
> 
> size_t is displayed via %zu
> 
> looks like it was changed in to
> d8df356d4ba46401181bdeacb207a5f2b731645c
> to cast it to an int, but seems like %zu would still be the correct
> fix.

Normally yes. But Wget is still C89 code and we don't want to change
it.


Regards, Tim




reply via email to

[Prev in Thread] Current Thread [Next in Thread]