Bug 53996 - format string issue in gcc-interface/utils.c
Summary: format string issue in gcc-interface/utils.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.8.0
: P3 minor
Target Milestone: 4.8.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-17 13:04 UTC by Martin Ettl
Modified: 2012-12-15 17:53 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-12-15 00:00:00


Attachments
proposed patch (229 bytes, patch)
2012-07-17 13:04 UTC, Martin Ettl
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Ettl 2012-07-17 13:04:58 UTC
Created attachment 27813 [details]
proposed patch

Please review the attached patch. It fixes a format string issue in file: /gcc/gcc/ada/gcc-interface/utils.c


This patch replaces the format string in an sprintf expression from %d to %u:

      sprintf (type_name, "%sSIGNED_%d", unsignedp ? "UN" : "", precision);

because the variable precision is of type unsigned, which requires %u.

Best regards

Ettl Martin
Comment 1 Eric Botcazou 2012-12-15 12:01:08 UTC
Confirmed, will apply.
Comment 2 Eric Botcazou 2012-12-15 17:50:55 UTC
Author: ebotcazou
Date: Sat Dec 15 17:50:49 2012
New Revision: 194520

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194520
Log:
	PR ada/53996
	* gcc-interface/utils.c (gnat_type_for_size): Use %u in lieu of %d.

Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/gcc-interface/utils.c
Comment 3 Eric Botcazou 2012-12-15 17:53:31 UTC
Thanks for reporting the issue.