Merge remote-tracking branch 'konrad/fix-compiler-warnings' into 3.15

* konrad/fix-compiler-warnings:
  epicsTime: rely on implicit copy constructor
  iocLogServer: check return values
  Fix potential buffer overflow in iocLogServer
  Fix weird use of strncpy
This commit is contained in:
Michael Davidsaver
2019-06-24 18:21:32 -07:00
7 changed files with 18 additions and 14 deletions

View File

@@ -329,9 +329,9 @@ static long get_enum_strs(DBADDR *paddr,struct dbr_enumStrs *pes)
/*SETTING no_str=0 breaks channel access clients*/
pes->no_str = 2;
memset(pes->strs,'\0',sizeof(pes->strs));
strncpy(pes->strs[0],prec->znam,sizeof(prec->znam));
strncpy(pes->strs[0],prec->znam,sizeof(pes->strs[0]));
if(*prec->znam!=0) pes->no_str=1;
strncpy(pes->strs[1],prec->onam,sizeof(prec->onam));
strncpy(pes->strs[1],prec->onam,sizeof(pes->strs[1]));
if(*prec->onam!=0) pes->no_str=2;
return(0);
}

View File

@@ -98,7 +98,7 @@ static void monitor(stateRecord *prec)
monitor_mask = recGblResetAlarms(prec);
if(strncmp(prec->oval,prec->val,sizeof(prec->val))) {
db_post_events(prec,&(prec->val[0]),monitor_mask|DBE_VALUE|DBE_LOG);
strncpy(prec->oval,prec->val,sizeof(prec->val));
strncpy(prec->oval,prec->val,sizeof(prec->oval));
}
return;
}

View File

@@ -120,7 +120,7 @@ static long init_record(stringinRecord *prec, int pass)
if( pdset->init_record ) {
if((status=(*pdset->init_record)(prec))) return(status);
}
strncpy(prec->oval, prec->val, sizeof(prec->val));
strncpy(prec->oval, prec->val, sizeof(prec->oval));
return(0);
}
@@ -160,7 +160,7 @@ static void monitor(stringinRecord *prec)
if (strncmp(prec->oval, prec->val, sizeof(prec->val))) {
monitor_mask |= DBE_VALUE | DBE_LOG;
strncpy(prec->oval, prec->val, sizeof(prec->val));
strncpy(prec->oval, prec->val, sizeof(prec->oval));
}
if (prec->mpst == stringinPOST_Always)

View File

@@ -122,7 +122,7 @@ static long init_record(stringoutRecord *prec, int pass)
if( pdset->init_record ) {
if((status=(*pdset->init_record)(prec))) return(status);
}
strncpy(prec->oval, prec->val, sizeof(prec->val));
strncpy(prec->oval, prec->val, sizeof(prec->oval));
return(0);
}
@@ -188,7 +188,7 @@ static void monitor(stringoutRecord *prec)
if (strncmp(prec->oval, prec->val, sizeof(prec->val))) {
monitor_mask |= DBE_VALUE | DBE_LOG;
strncpy(prec->oval, prec->val, sizeof(prec->val));
strncpy(prec->oval, prec->val, sizeof(prec->oval));
}
if (prec->mpst == stringoutPOST_Always)