From f09182a3b4fbbbae090f4812342e16984e6ea8be Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 6 May 2021 10:41:40 -0700 Subject: 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 Acked-by: Paolo Valerio --- lib/ofp-group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/ofp-group.c') 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); -- cgit v1.2.1