From 772270f3b6a37a2dd9432541cce436e9b45bb6b9 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 20 Apr 2020 14:12:38 -0400 Subject: *: sprintf -> snprintf Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young --- ospfd/ospf_dump_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ospfd/ospf_dump_api.c') diff --git a/ospfd/ospf_dump_api.c b/ospfd/ospf_dump_api.c index 1196339c34..e24936a473 100644 --- a/ospfd/ospf_dump_api.c +++ b/ospfd/ospf_dump_api.c @@ -105,7 +105,7 @@ char *ospf_options_dump(uint8_t options) { static char buf[OSPF_OPTION_STR_MAXLEN]; - snprintf(buf, OSPF_OPTION_STR_MAXLEN, "*|%s|%s|%s|%s|%s|%s|%s", + snprintf(buf, sizeof(buf), "*|%s|%s|%s|%s|%s|%s|%s", (options & OSPF_OPTION_O) ? "O" : "-", (options & OSPF_OPTION_DC) ? "DC" : "-", (options & OSPF_OPTION_EA) ? "EA" : "-", -- cgit v1.2.3