From: Quirin Gylstorff <
quirin.g...@siemens.com>
This fixes the following error with gcc-15:
In function 'bgenv_get_uint',
inlined from 'bgenv_get' at env/env_api_fat.c:360:10:
env/env_api_fat.c:296:9: error: 'strncpy' output may be truncated copying between 2 and 4 bytes from a string of length 254 [-Werror=stringop-truncation]
296 | strncpy(data, buffer, res+1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
As sprintf adds already a null-terminator and data is a void pointer
we can use memcpy directly.
Signed-off-by: Quirin Gylstorff <
quirin.g...@siemens.com>
---
env/env_api_fat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/env/env_api_fat.c b/env/env_api_fat.c
index 7c84dc6..b409d45 100644
--- a/env/env_api_fat.c
+++ b/env/env_api_fat.c
@@ -293,7 +293,7 @@ static int bgenv_get_uint(char *buffer, uint64_t *type, void *data,
if (!data) {
return res+1;
}
- strncpy(data, buffer, res+1);
+ memcpy(data, buffer, res+1);
if (type) {
*type = t;
}
--
2.50.1