Change strncpy to strlcpy

Change all function calls to strncpy to strlcpy.

Change-Id: I2bbefb7829d715847c5b26f4b9f0faddbd4c89d0
diff --git a/Loop.cpp b/Loop.cpp
index ca26093..1ed5bd0 100644
--- a/Loop.cpp
+++ b/Loop.cpp
@@ -121,7 +121,7 @@
         errno = ENOENT;
         return -1;
     }
-    strncpy(buffer, filename, len -1);
+    strlcpy(buffer, filename, len);
     return 0;
 }
 
@@ -191,7 +191,7 @@
         return -1;
     }
 
-    strncpy(loopDeviceBuffer, filename, len -1);
+    strlcpy(loopDeviceBuffer, filename, len);
 
     int file_fd;
 
diff --git a/Process.cpp b/Process.cpp
index b675436..cc06998 100644
--- a/Process.cpp
+++ b/Process.cpp
@@ -110,7 +110,7 @@
         if (readSymLink(path, link, sizeof(link)) && pathMatchesMountPoint(link, mountPoint)) {
             if (openFilename) {
                 memset(openFilename, 0, max);
-                strncpy(openFilename, link, max-1);
+                strlcpy(openFilename, link, max);
             }
             closedir(dir);
             return 1;
@@ -140,7 +140,7 @@
         if (path && pathMatchesMountPoint(path, mountPoint)) {
             if (openFilename) {
                 memset(openFilename, 0, max);
-                strncpy(openFilename, path, max-1);
+                strlcpy(openFilename, path, max);
             }
             fclose(file);
             return 1;
diff --git a/vdc.c b/vdc.c
index dcd2bc3..6927e92 100644
--- a/vdc.c
+++ b/vdc.c
@@ -145,8 +145,7 @@
                     int code;
                     char tmp[4];
 
-                    strncpy(tmp, buffer + offset, 3);
-                    tmp[3] = '\0';
+                    strlcpy(tmp, buffer + offset, sizeof(tmp));
                     code = atoi(tmp);
 
                     printf("%s\n", buffer + offset);