missing format string in applets/usage_pod.c

Laszlo Papp lpapp at kde.org
Mon Aug 18 19:13:54 UTC 2014


On Mon, Aug 18, 2014 at 7:50 PM, Cathey, Jim <jcathey at ciena.com> wrote:

> I don't like warnings on perfectly legal C.
>
> Promoting them to errors is even worse.
>
>
>
> That said, even with all this crap, provided
>
> that the strings are *constant* and don't contain
>
> substitutions the compiler has nothing to
>
> complain about.
>

It is not just about the warning and error, but the actual usage, too: if
you do not need a placeholder, why would you use printf in the first place?
It is not really meant for that. f/puts, on the other hand, were
established for that. While, it is "perfectly legal" C, like so many other
things that C sadly allows, it does not make much sense to me either. Note
that "perfectly legal" can be quite far from "perfectly reasonable".


>
>
> -- Jim
>
>
>
> *From:* busybox-bounces at busybox.net [mailto:busybox-bounces at busybox.net] *On
> Behalf Of *Tanguy Pruvot
> *Sent:* Thursday, August 14, 2014 6:45 AM
> *To:* Laszlo Papp
> *Cc:* waldeck at gmx.de; busybox
> *Subject:* Re: Re: Re: missing format string in applets/usage_pod.c
>
>
>
> its the same with bionic libc (arm)
>
>
>
> printf("test") is ok but not printf(buf) with char buf[] = "test";
> printf("%s", buf) is ok
>
>
>
> 2014-08-14 15:29 GMT+02:00 Laszlo Papp <lpapp at kde.org>:
>
> Sorry, the list was left out at some point due to my mistake ... See below.
>
>
>
> On Thu, Aug 14, 2014 at 2:28 PM, Laszlo Papp <lpapp at kde.org> wrote:
>
> On Thu, Aug 14, 2014 at 2:04 PM, <waldeck at gmx.de> wrote:
>
> Hi Laszlo,
>
>
> > Cannot reproduce with -Wall -Wpedantic -Wextra.
>
> Did you notice:
>
> applets/usage_pod.c:74:3: error: format not a string literal and no format
> arguments
> [-Werror=format-security]
>
> ^^^^^^^^^^^^^^^^?
>
>
>
> Hmm, yes, but I got used to that -Wall -Wpedantic -Wextra would cover the
> cases that need to be checked. I am not sure this option respects the C
> language though.
>
>
>
> Anyway, I guess I learnt something new today, thanks. :-)
>
>
>
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20140818/d4a3ed42/attachment-0001.html>


More information about the busybox mailing list