ecpg_LongStrucNameDump_fix.diff

text/plain

Filename: ecpg_LongStrucNameDump_fix.diff
Type: text/plain
Part: 0
Message: fix ecpg core dump when there's a very long struct variable name in .pgc file

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/interfaces/ecpg/preproc/type.c 2 2
diff --git a/postgresql-9.2rc1_org/src/interfaces/ecpg/preproc/type.c b/postgresql-9.2rc1_new/src/interfaces/ecpg/preproc/type.c
index c743616..48cbc13 100644
--- a/postgresql-9.2rc1_org/src/interfaces/ecpg/preproc/type.c
+++ b/postgresql-9.2rc1_new/src/interfaces/ecpg/preproc/type.c
@@ -506,8 +506,8 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz,
 	 */
 	struct ECPGstruct_member *p,
 			   *ind_p = NULL;
-	char		pbuf[BUFSIZ],
-				ind_pbuf[BUFSIZ];
+	char		*pbuf = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 3);
+	char		*ind_pbuf = (char *) mm_alloc(strlen(ind_name) + ((ind_prefix == NULL) ? 0 : strlen(ind_prefix)) + 3);
 
 	if (atoi(arrsiz) == 1)
 		sprintf(pbuf, "%s%s.", prefix ? prefix : "", name);