summaryrefslogtreecommitdiffstats
path: root/Loop.cpp
diff options
context:
space:
mode:
authorPeter Bohm <peter.m.bohm@sonyericsson.com>2011-04-01 12:35:25 +0200
committerOskar Andero <oskar.andero@sonyericsson.com>2011-06-27 10:04:05 +0200
commit092aa1c585fedd9e169eece41b8a471f1739908a (patch)
tree079f73d5594e22ecdb3504a261d6baeb60952e28 /Loop.cpp
parentb20d54b2309adee8d192942015740735ded975d3 (diff)
downloadandroid_system_vold-092aa1c585fedd9e169eece41b8a471f1739908a.tar.gz
android_system_vold-092aa1c585fedd9e169eece41b8a471f1739908a.tar.bz2
android_system_vold-092aa1c585fedd9e169eece41b8a471f1739908a.zip
Prevent buffer overflows.
To eliminate possible buffer overflows some strcpy, sprintf and strcat have been changed to strlcpy, snprintf and strlcat. Change-Id: Ieb9d4b600c894946a6492f8629ff39f2fcc106d3 Signed-off-by: Oskar Andero <oskar.andero@sonyericsson.com>
Diffstat (limited to 'Loop.cpp')
-rw-r--r--Loop.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Loop.cpp b/Loop.cpp
index 98015e2..dbfd331 100644
--- a/Loop.cpp
+++ b/Loop.cpp
@@ -188,8 +188,8 @@ int Loop::create(const char *id, const char *loopFile, char *loopDeviceBuffer, s
struct loop_info64 li;
memset(&li, 0, sizeof(li));
- strncpy((char*) li.lo_crypt_name, id, LO_NAME_SIZE);
- strncpy((char*) li.lo_file_name, loopFile, LO_NAME_SIZE);
+ strlcpy((char*) li.lo_crypt_name, id, LO_NAME_SIZE);
+ strlcpy((char*) li.lo_file_name, loopFile, LO_NAME_SIZE);
if (ioctl(fd, LOOP_SET_STATUS64, &li) < 0) {
SLOGE("Error setting loopback status (%s)", strerror(errno));