From: Luca Boccassi Date: Fri, 20 Aug 2021 17:15:35 +0000 (+0100) Subject: format-util/sd-bus: do not ignore snprintf result X-Git-Tag: v250-rc1~791^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=272fff7d8421767ef2caa60e982cf1bdae2c086c;p=thirdparty%2Fsystemd.git format-util/sd-bus: do not ignore snprintf result --- diff --git a/src/basic/format-util.c b/src/basic/format-util.c index 9920604f3ab..8174eaa81b8 100644 --- a/src/basic/format-util.c +++ b/src/basic/format-util.c @@ -15,9 +15,9 @@ char *format_ifname_full(int ifindex, char buf[static IF_NAMESIZE + 1], FormatIf return NULL; if (FLAGS_SET(flag, FORMAT_IFNAME_IFINDEX_WITH_PERCENT)) - snprintf(buf, IF_NAMESIZE + 1, "%%%d", ifindex); + assert(snprintf_ok(buf, IF_NAMESIZE + 1, "%%%d", ifindex)); else - snprintf(buf, IF_NAMESIZE + 1, "%d", ifindex); + assert(snprintf_ok(buf, IF_NAMESIZE + 1, "%d", ifindex)); return buf; } diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index ff8cf4ee0e4..12a50845db1 100644 --- a/src/libsystemd/sd-bus/bus-match.c +++ b/src/libsystemd/sd-bus/bus-match.c @@ -997,20 +997,16 @@ const char* bus_match_node_type_to_string(enum bus_match_node_type t, char buf[] return "path_namespace"; case BUS_MATCH_ARG ... BUS_MATCH_ARG_LAST: - snprintf(buf, l, "arg%i", t - BUS_MATCH_ARG); - return buf; + return snprintf_ok(buf, l, "arg%i", t - BUS_MATCH_ARG); case BUS_MATCH_ARG_PATH ... BUS_MATCH_ARG_PATH_LAST: - snprintf(buf, l, "arg%ipath", t - BUS_MATCH_ARG_PATH); - return buf; + return snprintf_ok(buf, l, "arg%ipath", t - BUS_MATCH_ARG_PATH); case BUS_MATCH_ARG_NAMESPACE ... BUS_MATCH_ARG_NAMESPACE_LAST: - snprintf(buf, l, "arg%inamespace", t - BUS_MATCH_ARG_NAMESPACE); - return buf; + return snprintf_ok(buf, l, "arg%inamespace", t - BUS_MATCH_ARG_NAMESPACE); case BUS_MATCH_ARG_HAS ... BUS_MATCH_ARG_HAS_LAST: - snprintf(buf, l, "arg%ihas", t - BUS_MATCH_ARG_HAS); - return buf; + return snprintf_ok(buf, l, "arg%ihas", t - BUS_MATCH_ARG_HAS); default: return NULL;