diff --git a/src/std/rec/stringinRecord.c b/src/std/rec/stringinRecord.c index 19f55866a..db2f626f1 100644 --- a/src/std/rec/stringinRecord.c +++ b/src/std/rec/stringinRecord.c @@ -93,6 +93,7 @@ static long readValue(stringinRecord *); static long init_record(stringinRecord *prec, int pass) { STATIC_ASSERT(sizeof(prec->oval)==sizeof(prec->val)); + STATIC_ASSERT(sizeof(prec->sval)==sizeof(prec->val)); struct stringindset *pdset; long status; @@ -119,7 +120,7 @@ static long init_record(stringinRecord *prec, int pass) if( pdset->init_record ) { if((status=(*pdset->init_record)(prec))) return(status); } - strcpy(prec->oval,prec->val); + strncpy(prec->oval, prec->val, sizeof(prec->val)); return(0); } @@ -193,7 +194,7 @@ static long readValue(stringinRecord *prec) status=dbGetLink(&(prec->siol),DBR_STRING, prec->sval,0,0); if (status==0) { - strcpy(prec->val,prec->sval); + strncpy(prec->val, prec->sval, sizeof(prec->val)); prec->udf=FALSE; } } else { diff --git a/src/std/rec/stringoutRecord.c b/src/std/rec/stringoutRecord.c index ea9012911..2bca3228c 100644 --- a/src/std/rec/stringoutRecord.c +++ b/src/std/rec/stringoutRecord.c @@ -95,6 +95,7 @@ static long writeValue(stringoutRecord *); static long init_record(stringoutRecord *prec, int pass) { STATIC_ASSERT(sizeof(prec->oval)==sizeof(prec->val)); + STATIC_ASSERT(sizeof(prec->ivov)==sizeof(prec->val)); struct stringoutdset *pdset; long status=0; @@ -121,7 +122,7 @@ static long init_record(stringoutRecord *prec, int pass) if( pdset->init_record ) { if((status=(*pdset->init_record)(prec))) return(status); } - strcpy(prec->oval,prec->val); + strncpy(prec->oval, prec->val, sizeof(prec->val)); return(0); } @@ -159,7 +160,7 @@ static long process(stringoutRecord *prec) break; case (menuIvoaSet_output_to_IVOV) : if(prec->pact == FALSE){ - strcpy(prec->val,prec->ivov); + strncpy(prec->val, prec->ivov, sizeof(prec->val)); } status=writeValue(prec); /* write the new value */ break;