Bug 4015

Summary: invalid printf(ptr); on applets/usage_pod.c
Product: Busybox Reporter: Ilya <semibiotic>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED INVALID    
Severity: minor CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Ilya 2011-07-28 07:26:36 UTC
Good time of day,

On module applets/usage_pod.c, there is invalid printf() call w/ raw string pointer as format. 

  on 1.18-stable it look like 

     printf(usage_array[i].aname);

(applets/usage_pod.c:74)

This method (causes resonable compiler warnings) is used with no visible reason (and/or comments) - there is no any post-format arguments. It's not quite exploitable as security hole (because uses compiled-in string array), but that isn't makes it less ugly.

I would switch it with "printf("%s", ptr);" or "fputs(ptr, stdout);", which both, though, take more .text memory.

Kind regards.
Comment 1 Denys Vlasenko 2011-07-29 16:39:24 UTC
(In reply to comment #0)
> I would switch it with "printf("%s", ptr);" or "fputs(ptr, stdout);"

Not a good idea -

> which both, though, take more .text memory.

Exactly.
Comment 2 Ilya 2011-08-11 14:11:24 UTC
In that event, this, probably, should be well commented on ?
Comment 3 Denys Vlasenko 2011-09-10 15:13:21 UTC
Not a bug. (Need to find a way to shut gcc up)...