Inconsistent snprintf format specification parsing

Bug #242089 reported by Dmitry Pankratov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mingw32-runtime (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: mingw32-runtime

OS: Ubuntu 8.04/AMD64.
Package: 3.13-1

Description:
The snprintf library function incorrectly parses the "%lu" format specifier as "unsigned long long" instead of "unsigned long" resulting in incorrect value formatting.

Example:
#include <stdio.h>
int main() {
    char buf[256];
    snprintf(buf, 256, "%lu", (size_t)12345678);
    printf(buf);
    return 0;
}

Prints:
9151369040453460302

Instead of:
12345678

Looks like this problem is fixed in the mingw-runtime 3.14.

Revision history for this message
Dmitry Pankratov (dremon) wrote :
Revision history for this message
Dmitry Pankratov (dremon) wrote :

Can somebody fix it please?? This is quite annoying issue. The patch is attached.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.