diff mbox

PR ada/54845

Message ID 20121010081117.GA13461@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 10, 2012, 8:11 a.m. UTC
This patch fixes an obvious buffer overflow in c-ada-spec.c:

              sprintf (buf, "field_%d : aliased ", field_num + 1);

where buf was too small. The original buffer was large enough, but then
the above string was made larger (change from "field_%d : " to
"field_%d : aliased " without making buf larger).

Tested on x86_64-pc-linux-gnu, committed as obvious on trunk.

2012-10-10  Arnaud Charlet  <charlet@adacore.com>

PR ada/54845
	* c-ada-spec.c (print_ada_struct_decl): Increase buf size.
diff mbox

Patch

Index: c-ada-spec.c
===================================================================
--- c-ada-spec.c	(revision 192067)
+++ c-ada-spec.c	(working copy)
@@ -3068,7 +3068,7 @@  print_ada_struct_decl (pretty_printer *b
   tree tmp;
   int is_union =
     TREE_CODE (node) == UNION_TYPE || TREE_CODE (node) == QUAL_UNION_TYPE;
-  char buf[16];
+  char buf[32];
   int field_num = 0;
   int field_spc = spc + INDENT_INCR;
   int need_semicolon;