summaryrefslogtreecommitdiff
path: root/lib/ofp-group.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2021-05-06 10:41:40 -0700
committerBen Pfaff <blp@ovn.org>2021-05-07 12:14:13 -0700
commitf09182a3b4fbbbae090f4812342e16984e6ea8be (patch)
treebcd4cca1821a8b95463d8a134bb7d30418114df9 /lib/ofp-group.c
parent09fe18af2d83848694d7336a35df790c7d7885ba (diff)
downloadopenvswitch-f09182a3b4fbbbae090f4812342e16984e6ea8be.tar.gz
ofp-group: Use big-enough buffer in ofputil_format_group().
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@ovn.org> Acked-by: Paolo Valerio <pvalerio@redhat.com>
Diffstat (limited to 'lib/ofp-group.c')
-rw-r--r--lib/ofp-group.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ofp-group.c b/lib/ofp-group.c
index bf0f8af54..737f48047 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);