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>
diff --git a/Loop.cpp b/Loop.cpp
index 98015e2..dbfd331 100644
--- a/Loop.cpp
+++ b/Loop.cpp
@@ -188,8 +188,8 @@
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));