From c5042727ae4c607d24db3f5deafbec9c8ca2b586 Mon Sep 17 00:00:00 2001 From: Shatur95 Date: Thu, 2 Jul 2020 02:36:54 +0300 Subject: [PATCH] Use qstrncpy Fixes MSVC C4996 warning. --- singleapplication_p.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/singleapplication_p.cpp b/singleapplication_p.cpp index 705609f..891f5a0 100644 --- a/singleapplication_p.cpp +++ b/singleapplication_p.cpp @@ -187,8 +187,7 @@ void SingleApplicationPrivate::startPrimary() inst->primary = true; inst->primaryPid = q->applicationPid(); - strncpy( inst->primaryUser, getUsername().toUtf8().data(), 127 ); - inst->primaryUser[127] = '\0'; + qstrncpy( inst->primaryUser, getUsername().toUtf8().data(), sizeof(inst->primaryUser) ); inst->checksum = blockChecksum(); instanceNumber = 0;