ReplaceStrncpy (#4823)

* replace strncpy with strlcpy

* keep strncpy to linux

* cancel reseting of string ending for strlcpy

Co-authored-by: Randy <Randy@randysmac.attlocal.net>
Co-authored-by: RandySheriffH <rashuai@microsoft.com>
This commit is contained in:
RandySheriffH 2020-08-17 16:44:44 -07:00 committed by GitHub
parent 32a5f3d5b6
commit 6a360bad6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1602,10 +1602,13 @@ ORT_API_STATUS_IMPL(OrtApis::GetAvailableProviders, _Outptr_ char*** out_ptr,
if (out[i]) {
#ifdef _MSC_VER
strncpy_s(out[i], MAX_LEN, providers_available[i], MAX_LEN);
#else
strncpy(out[i], providers_available[i], MAX_LEN);
#endif
out[i][MAX_LEN] = '\0';
#elif defined(__APPLE__)
strlcpy(out[i], providers_available[i], MAX_LEN);
#else
strncpy(out[i], providers_available[i], MAX_LEN);
out[i][MAX_LEN] = '\0';
#endif
}
}
}