diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
index d099795b..de40d690 100644
--- a/src/openvpn/buffer.c
+++ b/src/openvpn/buffer.c
@@ -317,9 +317,9 @@ buf_catrunc(struct buffer *buf, const char *str)
     if (buf_forward_capacity(buf) <= 1)
     {
         int len = (int) strlen(str) + 1;
-        if (len < buf_forward_capacity_total(buf))
+        if ((len > 0) && (len < buf_forward_capacity_total(buf)))
         {
-            strncpynt((char *)(buf->data + buf->capacity - len), str, len);
+            memcpy((void *)(buf->data + buf->capacity - len), (void *)str, (size_t)len);
         }
     }
 }
