mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-04 16:20:19 +01:00
components/nvs: strlcpy is not available on Linux, replace with strncpy and terminate strings explicitly
This commit is contained in:
@@ -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
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user