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;