[cig-commits] r17027 - mc/1D/hc/trunk
becker at geodynamics.org
becker at geodynamics.org
Thu Jul 8 11:04:32 PDT 2010
Author: becker
Date: 2010-07-08 11:04:31 -0700 (Thu, 08 Jul 2010)
New Revision: 17027
Modified:
mc/1D/hc/trunk/hc_misc.c
Log:
Fixed apparently undetected buffer overflow problem.
Modified: mc/1D/hc/trunk/hc_misc.c
===================================================================
--- mc/1D/hc/trunk/hc_misc.c 2010-06-29 18:34:24 UTC (rev 17026)
+++ mc/1D/hc/trunk/hc_misc.c 2010-07-08 18:04:31 UTC (rev 17027)
@@ -143,13 +143,13 @@
hc_boolean append)
{
static hc_boolean init=FALSE; /* that's OK, multiple instances calling are fine */
- static char type[2];
+ static char type_s[3];
int i;
if(!init){
if(sizeof(HC_PREC) == sizeof(float)){
- sprintf(type,"f");
+ sprintf(type_s,"f");
}else if (sizeof(HC_PREC) == sizeof(double)){
- sprintf(type,"lf");
+ sprintf(type_s,"lf");
}else{
fprintf(stderr,"hc_get_flt_frmt_string: assignment error\n");
exit(-1);
@@ -157,9 +157,9 @@
init=TRUE;
}
if(!append)
- sprintf(string,"%%%s",type);
+ sprintf(string,"%%%s",type_s);
for(i=1;i<n;i++)
- sprintf(string,"%s %%%s",string,type);
+ sprintf(string,"%s %%%s",string,type_s);
}
//
// deal with boolean values/switches
More information about the CIG-COMMITS
mailing list