Adjust strncpy sizes
When building under bitbake with the latest openbmc, we get compile
warnings such as these:
```
| ../git/sections/cper-section-nvidia.c: In function 'ir_section_nvidia_to_cper':
| ../git/sections/cper-section-nvidia.c:67:9: error: '__builtin_strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
| 67 | strncpy(section_cper->Signature,
```
Using `strncpy` on its own is unsafe because a string too long will
end up in the destination buffer without NUL termination. Adjust
the strncpy to be one shorter than the buffer and force the trailing
byte to be a NUL.
Repeat this pattern for all `strncpy` calls.
Change-Id: I45c630733f0138d2b089a60f698d75e1c09de9e2
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/sections/cper-section-nvidia.c b/sections/cper-section-nvidia.c
index f0ccec6..e2f8aef 100644
--- a/sections/cper-section-nvidia.c
+++ b/sections/cper-section-nvidia.c
@@ -67,7 +67,8 @@
strncpy(section_cper->Signature,
json_object_get_string(
json_object_object_get(section, "signature")),
- sizeof(section_cper->Signature));
+ sizeof(section_cper->Signature) - 1);
+ section_cper->Signature[sizeof(section_cper->Signature) - 1] = '\0';
//Fields.
section_cper->ErrorType = json_object_get_int(