From 29cf0ff82386587e010ae2d417ff903da7537494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 10 Jan 2019 16:13:06 +0100 Subject: [PATCH] libsystemd-network: use xsprintf in one more place DECIMAL_STR_MAX includes space for NUL, so we don't need 2 here. --- src/libsystemd-network/dhcp-identifier.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/dhcp-identifier.c index 07496adaa3..4221b9c504 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)