Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 956707

Summary: scl-utils: missing format attribute on sprintf wrapper
Product: Red Hat Enterprise Linux 5 Reporter: Jan Zeleny <jzeleny>
Component: scl-utilsAssignee: Jan Zeleny <jzeleny>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.9CC: bkabrda, drieden, fweimer, jzeleny, pknirsch
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: scl-utils-20120927-5.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 953520
: 957183 (view as bug list) Environment:
Last Closed: 2013-09-30 22:05:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 953520    
Bug Blocks: 953462, 957183    

Description Jan Zeleny 2013-04-25 13:10:16 UTC
+++ This bug was initially created as a clone of Bug #953520 +++

Adding

static void check_asprintf( char **strp, const char *fmt, ... )
  __attribute__((format(printf, 2, 3)));

reveals the following misuse of check_asprintf:

scl.c: In function ‘list_packages_in_collection’:
scl.c:207:2: warning: too many arguments for format [-Wformat-extra-args]
  check_asprintf(&cmd, "rpm -qa --qf=\"#%%{name}-%%{version}-%%{release}.%%{arch}\n%%{sourcerpm}\n[%%{provides}\n]\"", colname);
  ^

--- Additional comment from Jindrich Novy on 2013-04-23 15:37:08 CEST ---

Hi Florian,

sorry, I don't get it. Why would you add __attribute__((format(printf, 2, 3)) to the check_asprintf() line to trigger this?

--- Additional comment from Florian Weimer on 2013-04-23 15:48:29 CEST ---

The attribute allows GCC to perform additional type checking.  The warning is quite  correct because the format string does not contain "%s", so the colname is either superfluous, or something is missing from the format string.

Comment 1 RHEL Program Management 2013-04-25 13:29:29 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 5 errata-xmlrpc 2013-09-30 22:05:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1303.html