This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 255693 - printf audit doesn't recognize format string passed as variable
Summary: printf audit doesn't recognize format string passed as variable
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 8.2
Hardware: All All
: P3 normal (vote)
Assignee: danilasergeyev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-05 11:50 UTC by danilasergeyev
Modified: 2016-03-16 08:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description danilasergeyev 2015-10-05 11:50:43 UTC
#include <stdio.h>

int main(int argc, char** argv) {
    char* format_str = "%s%lld";
    printf(format_str, "test", (long long) 12);  // wrong error mark: "Wrong number of arguments"
    return 0;
}

Audit doesn't recognize format_str as a format string passed to printf and treated second argument as a format string instead.
Comment 1 danilasergeyev 2015-10-28 13:39:57 UTC
Fixed, enum, change set: b20b8d98e46d
Comment 2 danilasergeyev 2015-10-28 15:27:51 UTC
Additional fix, enum, 79c63598c7ae
Comment 3 danilasergeyev 2015-10-29 11:55:11 UTC
Additional fix, enum, b23c6a10ce1d
Comment 4 Quality Engineering 2015-10-30 02:22:46 UTC
Integrated into 'main-silver', will be available in build *201510300002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/09fe97f1378c
User: Danila Sergeyev <danilasergeyev@netbeans.org>
Log: fix bug #255693 printf audit doesn't recognize format string passed as variable
(transplanted from b20b8d98e46d4dcaa9de9f4df31afc7967fff0ff)
Comment 5 soldatov 2015-11-20 12:27:32 UTC
Verified in NetBeans 8.1patch1