Files
epics-base/fix-907761.patch
2012-03-20 10:32:37 +00:00

71 lines
2.0 KiB
Diff

=== modified file 'src/db/dbAccess.c'
--- src/db/dbAccess.c 2010-10-05 19:27:37 +0000
+++ src/db/dbAccess.c 2012-01-06 00:11:42 +0000
@@ -969,7 +969,7 @@
case DBR_CHAR:
case DBR_UCHAR:
- if (nRequest && *nRequest > 1) {
+ if (nRequest && *nRequest > 0) {
maxlen = *nRequest - 1;
break;
}
@@ -984,8 +984,8 @@
if (!status) status = dbFindField(&dbEntry, pfldDes->name);
if (!status) {
rtnString = dbGetString(&dbEntry);
- strncpy(pbuf, rtnString, maxlen - 1);
- pbuf[maxlen - 1] = 0;
+ strncpy(pbuf, rtnString, maxlen);
+ pbuf[maxlen] = 0;
}
dbFinishEntry(&dbEntry);
} else {
@@ -1028,7 +1028,7 @@
case DBR_CHAR:
case DBR_UCHAR:
- if (nRequest && *nRequest > 1) {
+ if (nRequest && *nRequest > 0) {
maxlen = *nRequest - 1;
break;
}
@@ -1037,8 +1037,8 @@
return S_db_badDbrtype;
}
- strncpy(pbuf, (char *)paddr->pfield, maxlen - 1);
- pbuf[maxlen - 1] = 0;
+ strncpy(pbuf, (char *)paddr->pfield, maxlen);
+ pbuf[maxlen] = 0;
return 0;
}
=== modified file 'src/db/dbConvert.c'
--- src/db/dbConvert.c 2009-04-23 18:49:40 +0000
+++ src/db/dbConvert.c 2012-01-06 00:13:33 +0000
@@ -416,6 +416,10 @@
char *pbuffer = (char *)pto;
char *psrc=(char *)(paddr->pfield);
+ if (paddr->pfldDes && paddr->pfldDes->field_type == DBF_STRING) {
+ pbuffer[--nRequest] = 0;
+ if (nRequest == 0) return(0);
+ }
if(nRequest==1 && offset==0) {
*pbuffer = *psrc;
return(0);
@@ -436,6 +440,10 @@
unsigned char *pbuffer = (unsigned char *)pto;
char *psrc=(char *)(paddr->pfield);
+ if (paddr->pfldDes && paddr->pfldDes->field_type == DBF_STRING) {
+ pbuffer[--nRequest] = 0;
+ if (nRequest == 0) return(0);
+ }
if(nRequest==1 && offset==0) {
*pbuffer = *psrc;
return(0);