summaryrefslogtreecommitdiff
path: root/Process.cpp
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2016-02-29 13:39:17 -0800
committerGeorge Burgess <gbiv@google.com>2016-03-02 22:42:22 +0000
commit605d7ae18d6e33b5dc1f6bb813ae32781498a4cd (patch)
treecb5ced21660ab36e96e9319b66e51d2394a2b066 /Process.cpp
parented4800064ca7e521a0b85b02125732860daf9a2f (diff)
downloadvold-605d7ae18d6e33b5dc1f6bb813ae32781498a4cd.tar.gz
Cleanup uses of sprintf, add modes to open() with O_CREAT.
Change-Id: Iaed2538831b19ada26005bbef33cff28209c6512
Diffstat (limited to 'Process.cpp')
-rw-r--r--Process.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Process.cpp b/Process.cpp
index 962a460d..7dc01444 100644
--- a/Process.cpp
+++ b/Process.cpp
@@ -85,7 +85,7 @@ int Process::checkFileDescriptorSymLinks(int pid, const char *mountPoint, char *
// compute path to process's directory of open files
char path[PATH_MAX];
- sprintf(path, "/proc/%d/fd", pid);
+ snprintf(path, sizeof(path), "/proc/%d/fd", pid);
DIR *dir = opendir(path);
if (!dir)
return 0;
@@ -129,7 +129,7 @@ int Process::checkFileMaps(int pid, const char *mountPoint, char *openFilename,
FILE *file;
char buffer[PATH_MAX + 100];
- sprintf(buffer, "/proc/%d/maps", pid);
+ snprintf(buffer, sizeof(buffer), "/proc/%d/maps", pid);
file = fopen(buffer, "r");
if (!file)
return 0;
@@ -155,7 +155,7 @@ int Process::checkSymLink(int pid, const char *mountPoint, const char *name) {
char path[PATH_MAX];
char link[PATH_MAX];
- sprintf(path, "/proc/%d/%s", pid, name);
+ snprintf(path, sizeof(path), "/proc/%d/%s", pid, name);
if (readSymLink(path, link, sizeof(link)) && pathMatchesMountPoint(link, mountPoint))
return 1;
return 0;