File alog-bufferoverflow.patch of Package mpich
copying the string into the first 12 chars of x into c is not needed.
xx_write() does exactly the same stuff again later. (line 77)
so instead of copying the data here and copy it again later we pass the
full length x to xx_write() and let it cut there.
Index: mpid/ch_p4/p4/alog/alog.c
===================================================================
--- mpid/ch_p4/p4/alog/alog.c.orig 2010-03-04 14:40:41.000000000 +0100
+++ mpid/ch_p4/p4/alog/alog.c 2010-03-04 14:40:45.000000000 +0100
@@ -243,9 +243,9 @@ int id;
strcat(x,"-");
strncat(x,cd+22,2);
- strcpy(c," ");
- strncpy(c,x,12);
- xx_write(head,0,(-1),0,c);
+// strcpy(c," ");
+// strncpy(c,x,12);
+ xx_write(head,0,(-1),0,x);
sprintf(x,"%lu", (unsigned long) usc_rollover_val());
xx_write(head,0,(-11),0,x);
Index: mpe/src/clog.c
===================================================================
--- mpe/src/clog.c.orig 2010-03-04 14:40:41.000000000 +0100
+++ mpe/src/clog.c 2010-03-04 14:46:44.000000000 +0100
@@ -426,7 +426,7 @@ char *description;
if (description)
strncpy(((CLOG_EVENT *)CLOG_ptr)->description, description,
- sizeof(CLOG_CNAME));
+ sizeof(CLOG_DESC)-1);
else
* ((char *) ((CLOG_EVENT *)CLOG_ptr)->description) = '\0';