official caput.patch

This commit is contained in:
zimoch
2013-05-23 09:01:55 +00:00
parent 4184693708
commit fed5a97f05
2 changed files with 20 additions and 2 deletions

18
caput.patch Normal file
View File

@@ -0,0 +1,18 @@
=== modified file 'src/catools/caput.c'
--- src/catools/caput.c 2011-11-07 17:58:09 +0000
+++ src/catools/caput.c 2012-09-03 19:25:44 +0000
@@ -492,12 +492,12 @@
if (charArrAsStr) {
count = len;
dbrType = DBR_CHAR;
- ebuf = calloc(strlen(cbuf), sizeof(char));
+ ebuf = calloc(strlen(cbuf)+1, sizeof(char));
if(!ebuf) {
fprintf(stderr, "Memory allocation failed\n");
return 1;
}
- epicsStrnRawFromEscaped(ebuf, strlen(cbuf), cbuf, strlen(cbuf));
+ epicsStrnRawFromEscaped(ebuf, strlen(cbuf)+1, cbuf, strlen(cbuf));
} else {
for (i = 0; i < count; ++i) {
epicsStrnRawFromEscaped(sbuf[i], sizeof(EpicsStr), *(argv+optind+i), sizeof(EpicsStr));

View File

@@ -492,12 +492,12 @@ int main (int argc, char *argv[])
if (charArrAsStr) {
count = len;
dbrType = DBR_CHAR;
ebuf = calloc(strlen(cbuf), sizeof(char));
ebuf = calloc(strlen(cbuf)+1, sizeof(char));
if(!ebuf) {
fprintf(stderr, "Memory allocation failed\n");
return 1;
}
epicsStrnRawFromEscaped(ebuf, strlen(cbuf), cbuf, strlen(cbuf));
epicsStrnRawFromEscaped(ebuf, strlen(cbuf)+1, cbuf, strlen(cbuf));
} else {
for (i = 0; i < count; ++i) {
epicsStrnRawFromEscaped(sbuf[i], sizeof(EpicsStr), *(argv+optind+i), sizeof(EpicsStr));