Merge "IPACM: Do not use deprecated strncpy function"
diff --git a/ipanat/src/ipa_nat_drvi.c b/ipanat/src/ipa_nat_drvi.c
index 9b06028..675dcf5 100644
--- a/ipanat/src/ipa_nat_drvi.c
+++ b/ipanat/src/ipa_nat_drvi.c
@@ -35,11 +35,16 @@
#define strlcpy g_strlcpy
#else
#ifndef FEATURE_IPA_ANDROID
-static size_t strlcpy(char * dst, const char * src, size_t size) {
+static size_t strlcpy(char * dst, const char * src, size_t size)
+{
+ size_t i;
+
if (size < 1)
return 0;
- strncpy(dst, src, size - 1);
- dst[size - 1] = 0;
+ for (i = 0; i < (size - 1) && src[i] != '\0'; i++)
+ dst[i] = src[i];
+ for (; i < size; i++)
+ dst[i] = '\0';
return strlen(dst);
}
#endif