diff options
author | Jake Petroules <jake.petroules@qt.io> | 2016-09-15 18:22:50 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-09-15 18:22:50 +0000 |
commit | eecc5fc52c919d6607e610d858c2749977a1ef75 (patch) | |
tree | dc8c5f6621d6fbaa76bd28c1c127905444ccf50e /src/corelib/tools/qbytearray.cpp | |
parent | 6b3845320a9242481842243f2c019aa11ce396df (diff) | |
parent | 40a1f69e8663fb79560c26cfad5ead45b1b3ee5f (diff) |
Merge "Merge remote-tracking branch 'origin/5.8' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 71bbd80980..7d9c5dc325 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -303,13 +303,14 @@ char *qstrncpy(char *dst, const char *src, uint len) { if (!src || !dst) return 0; + if (len > 0) { #if defined(_MSC_VER) && _MSC_VER >= 1400 - strncpy_s(dst, len, src, len-1); + strncpy_s(dst, len, src, len - 1); #else - strncpy(dst, src, len); + strncpy(dst, src, len); #endif - if (len > 0) dst[len-1] = '\0'; + } return dst; } |