From 1475845675aba03b356697561f3600f4d08317ec Mon Sep 17 00:00:00 2001
From: Geoffrey McRae <geoff@hostfission.com>
Date: Fri, 1 Mar 2019 21:03:10 +1100
Subject: [PATCH] [c-host] correct buffer size for stncat

---
 c-host/linux/platform.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/c-host/linux/platform.c b/c-host/linux/platform.c
index 4c4c9d75..f84055af 100644
--- a/c-host/linux/platform.c
+++ b/c-host/linux/platform.c
@@ -82,8 +82,8 @@ int main(int argc, char * argv[])
   // get the device size
   {
     char file[100] = "/sys/class/uio/";
-    strncat(file, params.shmDevice , sizeof(file));
-    strncat(file, "/maps/map0/size", sizeof(file));
+    strncat(file, params.shmDevice , sizeof(file) - 1);
+    strncat(file, "/maps/map0/size", sizeof(file) - 1);
 
     int fd = open(file, O_RDONLY);
     if (fd < 0)
@@ -109,7 +109,7 @@ int main(int argc, char * argv[])
   // open the device
   {
     char file[100] = "/dev/";
-    strncat(file, params.shmDevice, sizeof(file));
+    strncat(file, params.shmDevice, sizeof(file) - 1);
     app.shmFD   = open(file, O_RDWR, (mode_t)0600);
     app.shmMap  = MAP_FAILED;
     if (app.shmFD < 0)