diff options
Diffstat (limited to 'src/thirdparty/unrar/strfn.cpp')
-rw-r--r-- | src/thirdparty/unrar/strfn.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/thirdparty/unrar/strfn.cpp b/src/thirdparty/unrar/strfn.cpp index c2888a09c..f83482fb2 100644 --- a/src/thirdparty/unrar/strfn.cpp +++ b/src/thirdparty/unrar/strfn.cpp @@ -265,8 +265,9 @@ wchar* wcsncpyz(wchar *dest, const wchar *src, size_t maxlen) char* strncatz(char* dest, const char* src, size_t maxlen) { size_t Length = strlen(dest); - if (Length + 1 < maxlen) - strncat(dest, src, maxlen - Length - 1); + int avail=int(maxlen - Length - 1); + if (avail > 0) + strncat(dest, src, avail); return dest; } @@ -277,8 +278,9 @@ char* strncatz(char* dest, const char* src, size_t maxlen) wchar* wcsncatz(wchar* dest, const wchar* src, size_t maxlen) { size_t Length = wcslen(dest); - if (Length + 1 < maxlen) - wcsncat(dest, src, maxlen - Length - 1); + int avail=int(maxlen - Length - 1); + if (avail > 0) + wcsncat(dest, src, avail); return dest; } |