projects
/
oweals
/
cde.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8f7c874
)
dtfile/SharedProcs.c: rework coverity 174852 fix to unbreak dtfile
author
Jon Trulson
<jon@radscan.com>
Wed, 4 Apr 2018 02:59:48 +0000
(20:59 -0600)
committer
Jon Trulson
<jon@radscan.com>
Wed, 4 Apr 2018 03:28:49 +0000
(21:28 -0600)
cde/programs/dtfile/SharedProcs.c
patch
|
blob
|
history
diff --git
a/cde/programs/dtfile/SharedProcs.c
b/cde/programs/dtfile/SharedProcs.c
index 63b7c1158f57bba294b18a5a1bbdd73ae13f993e..eadcc2f97af06cecb7b1909971bc74983829d30b 100644
(file)
--- a/
cde/programs/dtfile/SharedProcs.c
+++ b/
cde/programs/dtfile/SharedProcs.c
@@
-1631,6
+1631,7
@@
_DtPathFromInput(
FILE *pfp;
char command[MAXPATHLEN];
+ memset(command, 0, sizeof(command));
sprintf(command,"echo %s",path);
if((pfp=popen(command,"r")) != NULL)
@@
-1654,9
+1655,13
@@
_DtPathFromInput(
read_ok = 0;
}
- if (read_ok)
+ if (read_ok)
{
- command[MAXPATHLEN-1] = '\0';
+ int slen = strlen(command);
+ /* need to remove the trailing newline safely*/
+ if (slen >= 1)
+ command[slen-1] = '\0';
+
XtFree(path);
path = XtNewString(command);
pclose(pfp);