summaryrefslogtreecommitdiffstats
path: root/adb/adb_utils.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-04-17 17:03:59 -0700
committerElliott Hughes <enh@google.com>2015-04-17 17:58:35 -0700
commita7090b94c181f3efe5b53d2c8367b78d99074dfe (patch)
tree6702f5455bac81bc5c42022fc4c472faf0f70a3c /adb/adb_utils.cpp
parent8d2abbea76f13b76ef814ff426d88f70526f6923 (diff)
downloadsystem_core-a7090b94c181f3efe5b53d2c8367b78d99074dfe.zip
system_core-a7090b94c181f3efe5b53d2c8367b78d99074dfe.tar.gz
system_core-a7090b94c181f3efe5b53d2c8367b78d99074dfe.tar.bz2
Remove yet more fixed-length buffers (and their overruns).
Bug: 20317724 Change-Id: If137fc96f5f23576ccecd388ac87afefa47337c6
Diffstat (limited to 'adb/adb_utils.cpp')
-rw-r--r--adb/adb_utils.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/adb/adb_utils.cpp b/adb/adb_utils.cpp
index 5a6ac33..b515f59 100644
--- a/adb/adb_utils.cpp
+++ b/adb/adb_utils.cpp
@@ -16,10 +16,18 @@
#include "adb_utils.h"
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+bool getcwd(std::string* s) {
+ char* cwd = getcwd(nullptr, 0);
+ if (cwd != nullptr) *s = cwd;
+ free(cwd);
+ return (cwd != nullptr);
+}
+
bool directory_exists(const std::string& path) {
struct stat sb;
return lstat(path.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode);