From: Zbigniew Jędrzejewski-Szmek Date: Thu, 10 Jan 2019 15:13:06 +0000 (+0100) Subject: libsystemd-network: use xsprintf in one more place X-Git-Tag: v241-rc1~49^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=29cf0ff82386587e010ae2d417ff903da7537494;p=thirdparty%2Fsystemd.git libsystemd-network: use xsprintf in one more place DECIMAL_STR_MAX includes space for NUL, so we don't need 2 here. --- diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/dhcp-identifier.c index 07496adaa39..4221b9c5044 100644 --- a/src/libsystemd-network/dhcp-identifier.c +++ b/src/libsystemd-network/dhcp-identifier.c @@ -11,6 +11,7 @@ #include "network-internal.h" #include "siphash24.h" #include "sparse-endian.h" +#include "stdio-util.h" #include "virt.h" #define SYSTEMD_PEN 43793 @@ -169,10 +170,10 @@ int dhcp_identifier_set_iaid( if (detect_container() <= 0) { /* not in a container, udev will be around */ - char ifindex_str[2 + DECIMAL_STR_MAX(int)]; + char ifindex_str[1 + DECIMAL_STR_MAX(int)]; int r; - sprintf(ifindex_str, "n%d", ifindex); + xsprintf(ifindex_str, "n%d", ifindex); if (sd_device_new_from_device_id(&device, ifindex_str) >= 0) { r = sd_device_get_is_initialized(device); if (r < 0)