changeset 286:141f2a86d4a8

[project @ 2003-10-04 14:41:18 by bellard] unbounded section name (might be useful when section name contains function name for g++ linkonce sections)
author bellard
date Sat, 04 Oct 2003 14:41:18 +0000
parents 96460040254e
children 462860741295
files tcc.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tcc.c	Sat Oct 04 13:04:47 2003 +0000
+++ b/tcc.c	Sat Oct 04 14:41:18 2003 +0000
@@ -175,7 +175,7 @@
     struct Section *reloc;   /* corresponding section for relocation, if any */
     struct Section *hash;     /* hash table for symbols */
     struct Section *next;
-    char name[64];           /* section name */
+    char name[1];           /* section name */
 } Section;
 
 typedef struct DLLReference {
@@ -964,8 +964,8 @@
 {
     Section *sec;
 
-    sec = tcc_mallocz(sizeof(Section));
-    pstrcpy(sec->name, sizeof(sec->name), name);
+    sec = tcc_mallocz(sizeof(Section) + strlen(name));
+    strcpy(sec->name, name);
     sec->sh_type = sh_type;
     sec->sh_flags = sh_flags;
     switch(sh_type) {