Bug 9539 - Resolve string formatting issues in busybox
Summary: Resolve string formatting issues in busybox
Status: RESOLVED WONTFIX
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.2
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.5
Assignee: Ross Burton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-04-28 10:34 UTC by Joshua Lock
Modified: 2018-02-09 23:20 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Lock 2016-04-28 10:34:17 UTC
Busybox fails to compile with compiler flags which elevate common string formatting issues into an error (-Wformat -Wformat-security -Werror=format-security).
Comment 1 Joshua Lock 2017-02-07 13:20:21 UTC
Setting assignee to recipe maintainer. Chen Qi, please feel free to update estimate, target, etc. to suit your workload.
Comment 2 Joshua Lock 2017-02-07 13:24:45 UTC
Note: to observe the failures comment out the recipe's SECURITY_STRINGFORMAT entry in security_cflags.inc and build the recipe with a configuration that utilises security_cflags (i.e. the poky-lsb distro).
Comment 3 Diana Thayer 2017-06-12 18:52:20 UTC
Unassigned myself after struggling with it for a while :(
Comment 4 Maxin B. John 2018-02-06 13:38:09 UTC
From this commit (ca81a937225714f75157eb596d90255243ae2e29),  it seems the mainline is not super interested in fixing these kind of format related bugs in busybox (mainly due to size)

---
disable format security warnings

We pass strings to printf directly a lot.  Some distros enable some flags
in their gcc by default like -Wformat-security.  With these two things, we
end up with a lot of build warnings like so:
	loginutils/chpasswd.c:42:3: warning: format not a string literal and
		no format arguments [-Wformat-security]

But we don't care.  Our focus is first and foremost on size, so adding a
lot of dummy calls like:
-	printf(some_constant_string);
+	printf("%s", some_constant_string);
is pointless bloat.

Disable this warning flag if the compiler supports it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

https://git.busybox.net/busybox/commit/?id=ca81a937225714f75157eb596d90255243ae2e29
Comment 5 Maxin B. John 2018-02-06 13:42:59 UTC
Even if we prepare patches for format-security warnings, busybox mainline would treat it as "pointless bloat". Should we still fix those and carry the burden with us ?
Comment 6 Ross Burton 2018-02-09 23:20:39 UTC
Wow that's impressive logic.

If printf(string) is fine but printf("%s", string) is bloat, surely printf(string) is bloat as puts(string) is more efficient?

Yes, if upstream refuse to fix these, then I think we just have to sigh.  At least their forcing the flag off...