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 256574 - Wrong format string notification
Summary: Wrong format string notification
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Windows 10 x64
: P3 normal (vote)
Assignee: danilasergeyev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-13 07:17 UTC by noisebringer
Modified: 2015-12-21 19:17 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Bug screenshot (3.06 KB, image/png)
2015-11-13 07:17 UTC, noisebringer
Details
fix of bug #256574 (4.16 KB, patch)
2015-11-16 15:51 UTC, danilasergeyev
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description noisebringer 2015-11-13 07:17:51 UTC
Created attachment 157319 [details]
Bug screenshot

printf("Set-Cookie: pcd=%s; expires=%s; path=/;\r\n", Row[1], CookieExpiration);

This format string if notified as wrong because NetBeans treats Row[1] as char variable, not as char pointer.
Comment 1 Alexander Simon 2015-11-13 07:28:21 UTC
Please provide declaration of Row[1]
Comment 2 noisebringer 2015-11-13 07:39:37 UTC
MYSQL_ROW Row;

Row is variable of MYSQL_ROW type. It contains Row requested from Mysql database.
Code works fine and clear. The only wrong thing is treatment of format string with this variable.
Comment 3 noisebringer 2015-11-13 07:40:58 UTC
Row is filled with this code string Row = mysql_fetch_row(Result)
Comment 4 Alexander Simon 2015-11-13 07:42:56 UTC
To resolve the problem we need a declaration of Row including all typedefs/macros.
Or provide sample project with the problem.
Thanks.
Comment 5 noisebringer 2015-11-13 07:47:28 UTC
This type is defined in mysql.h file with this code

typedef char **MYSQL_ROW;
Comment 6 Alexander Simon 2015-11-13 07:53:35 UTC
So example is:

#include <stdio.h>
typedef char **MYSQL_ROW;
int foo (MYSQL_ROW Row) {
    printf("pcd=%s;\r\n", Row[1]); // wrong hint
}
int boo (char** Row) {
    printf("pcd=%s;\r\n", Row[1]); // no hint
}
int main(int argc, char** argv) {
    return 0;
}
Comment 7 noisebringer 2015-11-13 07:57:00 UTC
Exactly!
Comment 8 danilasergeyev 2015-11-16 15:51:30 UTC
Created attachment 157365 [details]
fix of bug #256574
Comment 9 danilasergeyev 2015-11-16 15:51:53 UTC
fixed in the attached patch
Comment 10 noisebringer 2015-11-17 04:17:45 UTC
I'm not expirienced in applying patches. So could you provide some link or short info about doing it on windows 10?
It would be very very nice :)
Comment 11 danilasergeyev 2015-11-18 16:35:35 UTC
fixed in change set a6bf507c3c25 (enum)
Comment 12 Quality Engineering 2015-11-24 02:31:44 UTC
Integrated into 'main-silver', will be available in build *201511240002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/5efcccad3e2f
User: Danila Sergeyev <danilasergeyev@netbeans.org>
Log: fix bug #256574 Wrong format string notification
(transplanted from a6bf507c3c254f63252f1876397de603c2be15bf)
Comment 13 noisebringer 2015-11-25 06:48:42 UTC
How about including this fix to current version.
I mean it would be great if every user could press Help -> Check for updates and then install this patch. :)
Is it possible?
Comment 14 soldatov 2015-12-21 19:17:35 UTC
Verified in NetBeans 8.1 with latest internal patches