components/nvs: strlcpy is not available on Linux, replace with strncpy and terminate strings explicitly

This commit is contained in:
Ivan Grokhotkov
2016-08-23 15:14:13 +08:00
parent 3df4130eb7
commit 9ef827ae20
5 changed files with 12 additions and 10 deletions

View File

@@ -161,7 +161,8 @@ esp_err_t Storage::createOrOpenNamespace(const char* nsName, bool canCreate, uin
NamespaceEntry* entry = new NamespaceEntry;
entry->mIndex = ns;
strlcpy(entry->mName, nsName, sizeof(entry->mName));
strncpy(entry->mName, nsName, sizeof(entry->mName) - 1);
entry->mName[sizeof(entry->mName) - 1] = 0;
mNamespaces.push_back(entry);
} else {
@@ -250,4 +251,4 @@ void Storage::debugCheck()
}
#endif //ESP_PLATFORM
}
}