On 11/5/26 13:51, Philippe Mathieu-Daudé wrote:
Replace sprintf() by safer g_strdup_printf() to format the
host address, silencing -Wdeprecated-declarations produced
by Apple clang 17.0.0.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
hw/vfio/pci.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 0da2e143b88a..eea96240b7c9 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2857,10 +2857,9 @@ void vfio_pci_post_reset(VFIOPCIDevice *vdev)
bool vfio_pci_host_match(PCIHostDeviceAddress *addr, const char *name)
{
- char tmp[36];
-
- sprintf(tmp, "%04x:%02x:%02x.%1x", addr->domain,
- addr->bus, addr->slot, addr->function);
+ g_autofree char *tmp = g_strdup_printf("%04x:%02x:%02x.%1x",
+ addr->domain, addr->bus, addr->slot,
+ addr->function);
return (strcmp(tmp, name) == 0);
}
Reviewed-by: Cédric Le Goater <[email protected]>
Thanks,
C.