We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There are a few strncpy() invocations that could result in a string that is not NULL-terminated.
I see the warning using SPIFFS V0.3.7
Here's a git diff showing the suggested change that was applied locally.
diff --git a/source/third_party/spiffs/spiffs_hydrogen.c b/source/third_party/spiffs/spiffs_hydrogen.c index 23c305a45..97a445f30 100644 --- a/source/third_party/spiffs/spiffs_hydrogen.c +++ b/source/third_party/spiffs/spiffs_hydrogen.c @@ -856,6 +856,7 @@ static s32_t spiffs_stat_pix(spiffs *fs, spiffs_page_ix pix, spiffs_file fh, spi s->size = objix_hdr.size == SPIFFS_UNDEFINED_LEN ? 0 : objix_hdr.size; s->pix = pix; strncpy((char *)s->name, (char *)objix_hdr.name, SPIFFS_OBJ_NAME_LEN);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
There are a few strncpy() invocations that could result in a string that is not NULL-terminated.
I see the warning using SPIFFS V0.3.7
Here's a git diff showing the suggested change that was applied locally.
diff --git a/source/third_party/spiffs/spiffs_hydrogen.c b/source/third_party/spiffs/spiffs_hydrogen.c
index 23c305a45..97a445f30 100644
--- a/source/third_party/spiffs/spiffs_hydrogen.c
+++ b/source/third_party/spiffs/spiffs_hydrogen.c
@@ -856,6 +856,7 @@ static s32_t spiffs_stat_pix(spiffs *fs, spiffs_page_ix pix, spiffs_file fh, spi
s->size = objix_hdr.size == SPIFFS_UNDEFINED_LEN ? 0 : objix_hdr.size;
s->pix = pix;
strncpy((char *)s->name, (char *)objix_hdr.name, SPIFFS_OBJ_NAME_LEN);
#if SPIFFS_OBJ_META_LEN
_SPIFFS_MEMCPY(s->meta, objix_hdr.meta, SPIFFS_OBJ_META_LEN);
#endif
diff --git a/source/third_party/spiffs/spiffs_nucleus.c b/source/third_party/spiffs/spiffs_nucleus.c
index 6b052b0e3..88bd55cab 100644
--- a/source/third_party/spiffs/spiffs_nucleus.c
+++ b/source/third_party/spiffs/spiffs_nucleus.c
@@ -945,6 +945,7 @@ s32_t spiffs_object_create(
oix_hdr.type = type;
oix_hdr.size = SPIFFS_UNDEFINED_LEN; // keep ones so we can update later without wasting this page
strncpy((char*)oix_hdr.name, (const char*)name, SPIFFS_OBJ_NAME_LEN);
#if SPIFFS_OBJ_META_LEN
if (meta) {
_SPIFFS_MEMCPY(oix_hdr.meta, meta, SPIFFS_OBJ_META_LEN);
@@ -1008,6 +1009,7 @@ s32_t spiffs_object_update_index_hdr(
// change name
if (name) {
strncpy((char*)objix_hdr->name, (const char*)name, SPIFFS_OBJ_NAME_LEN);
}
#if SPIFFS_OBJ_META_LEN
if (meta) {
The text was updated successfully, but these errors were encountered: