summaryrefslogtreecommitdiff
path: root/usb
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2019-09-06 12:37:53 -0700
committerJosh Gao <jmgao@google.com>2019-09-06 12:38:20 -0700
commitaf108633e9e45a0282a892d213b6e915c39ee050 (patch)
tree916c3623dca687f7a6091999d52fca36eaa5a8d4 /usb
parentd78e8f14658e351169bc7d26163248b38d50c2c1 (diff)
Remove uses of sprintf.
Test: mma Change-Id: Ibe4ba3d68de5f3a409e445511872b76c558d208c
Diffstat (limited to 'usb')
-rw-r--r--usb/UsbGadgetUtils.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/usb/UsbGadgetUtils.cpp b/usb/UsbGadgetUtils.cpp
index 5bb7e1d..4746572 100644
--- a/usb/UsbGadgetUtils.cpp
+++ b/usb/UsbGadgetUtils.cpp
@@ -39,7 +39,7 @@ int unlinkFunctions(const char *path) {
if ((strstr(function->d_name, FUNCTION_NAME) == NULL))
continue;
// build the path for each file in the folder.
- sprintf(filepath, "%s/%s", path, function->d_name);
+ snprintf(filepath, kMaxFilePathLength, "%s/%s", path, function->d_name);
ret = remove(filepath);
if (ret) {
ALOGE("Unable remove file %s errno:%d", filepath, errno);
@@ -69,8 +69,8 @@ int linkFunction(const char *function, int index) {
char functionPath[kMaxFilePathLength];
char link[kMaxFilePathLength];
- sprintf(functionPath, "%s%s", FUNCTIONS_PATH, function);
- sprintf(link, "%s%d", FUNCTION_PATH, index);
+ snprintf(functionPath, kMaxFilePathLength, "%s%s", FUNCTIONS_PATH, function);
+ snprintf(link, kMaxFilePathLength, "%s%d", FUNCTION_PATH, index);
if (symlink(functionPath, link)) {
ALOGE("Cannot create symlink %s -> %s errno:%d", link, functionPath, errno);
return -1;