[PATCH] umdns: fix compilation with GCC 10
Rosen Penev
rosenp at gmail.com
Sun Aug 30 18:07:03 EDT 2020
The previous fix seems to not be enough.
/service.c:242:10: error: 'strncpy' offset 6 from the object at 'b' is
out of the bounds of referenced subobject 'name' with type 'uint8_t[]'
{aka 'unsigned char[]'} at offset 6 [-Werror=array-bounds]
242 | s->id = strncpy(d_id, blobmsg_name(b), n);
Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
service.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/service.c b/service.c
index 53f44c1..e649b64 100644
--- a/service.c
+++ b/service.c
@@ -240,7 +240,7 @@ service_load_blob(struct blob_attr *b)
return;
s->port = blobmsg_get_u32(_tb[SERVICE_PORT]);
- s->id = strncpy(d_id, blobmsg_name(b), n);
+ s->id = memcpy(d_id, blobmsg_name(b), n);
if (_tb[SERVICE_INSTANCE])
s->instance = strcpy(d_instance, blobmsg_get_string(_tb[SERVICE_INSTANCE]));
else
--
2.26.2
More information about the openwrt-devel
mailing list