diff options
author | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2014-03-26 16:42:26 +0100 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2014-04-01 10:21:04 +0200 |
commit | 2d3dc13f481bd6a5dfc16511f7df89903b69c4fd (patch) | |
tree | 6f0ffd297c7fc6c7b517784753455e2860bde8ec /src/system/dlt-system-processes.c | |
parent | 8594f384fe8d622c20e7cb6091a2e99313e9830e (diff) | |
download | DLT-daemon-2d3dc13f481bd6a5dfc16511f7df89903b69c4fd.tar.gz |
Fixed: all possible malloc, sprintf and strcpy problems
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/system/dlt-system-processes.c')
-rw-r--r-- | src/system/dlt-system-processes.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/system/dlt-system-processes.c b/src/system/dlt-system-processes.c index 495c784..4457f50 100644 --- a/src/system/dlt-system-processes.c +++ b/src/system/dlt-system-processes.c @@ -69,7 +69,7 @@ void send_process(LogProcessOptions const *popts, int n) DLT_STRING("dlt-system-processes, send process info.")); FILE * pFile; struct dirent *dp; - char filename[256]; + char filename[PATH_MAX]; char buffer[1024]; int bytes; int found = 0; @@ -83,7 +83,7 @@ void send_process(LogProcessOptions const *popts, int n) if(isdigit(dp->d_name[0])) { buffer[0] = 0; - sprintf(filename, "/proc/%s/cmdline",dp->d_name); + snprintf(filename,PATH_MAX, "/proc/%s/cmdline",dp->d_name); pFile = fopen(filename, "r"); if(pFile != NULL) { @@ -94,7 +94,7 @@ void send_process(LogProcessOptions const *popts, int n) (strcmp(buffer, (*popts).Name[n])==0)) { found = 1; - sprintf(filename, "/proc/%s/%s", dp->d_name,(*popts).Filename[n]); + snprintf(filename,PATH_MAX, "/proc/%s/%s", dp->d_name,(*popts).Filename[n]); pFile = fopen(filename, "r"); if(pFile != NULL) { |