[ovs-dev] [PATCH 1/3] ofp-group: Use big-enough buffer in ofputil_format_group().
Ben Pfaff
blp at ovn.org
Thu May 6 17:54:08 UTC 2021
GCC 11 pointed out that ofputil_group_to_string()'s prototype asks for
a buffer with one byte more than supplied. This fixes the problem.
This wasn't a buffer overflow because ofputil_group_to_string() honors
the buffer size passed in, which was correct. The worst that could
happen was truncating the last byte of a group name.
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
lib/ofp-group.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ofp-group.c b/lib/ofp-group.c
index bf0f8af544c9..737f48047b10 100644
--- a/lib/ofp-group.c
+++ b/lib/ofp-group.c
@@ -64,7 +64,7 @@ ofputil_group_from_string(const char *s, uint32_t *group_idp)
void
ofputil_format_group(uint32_t group_id, struct ds *s)
{
- char name[MAX_GROUP_NAME_LEN];
+ char name[MAX_GROUP_NAME_LEN + 1];
ofputil_group_to_string(group_id, name, sizeof name);
ds_put_cstr(s, name);
--
2.31.1
More information about the dev
mailing list