[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 02/13] hw/vfio/pci: Replace sprintf() by snprintf()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 02/13] hw/vfio/pci: Replace sprintf() by snprintf() |
Date: |
Thu, 11 Apr 2024 12:15:38 +0200 |
sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience. Use snprintf() instead.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/vfio/pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 64780d1b79..cc545bcfbe 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2444,7 +2444,7 @@ bool vfio_pci_host_match(PCIHostDeviceAddress *addr,
const char *name)
{
char tmp[13];
- sprintf(tmp, "%04x:%02x:%02x.%1x", addr->domain,
+ snprintf(tmp, sizeof(tmp), "%04x:%02x:%02x.%1x", addr->domain,
addr->bus, addr->slot, addr->function);
return (strcmp(tmp, name) == 0);
--
2.41.0
- [PATCH v2 00/13] misc: Remove sprintf() due to macOS deprecation, Philippe Mathieu-Daudé, 2024/04/11
- [PATCH v2 04/13] hw/mips/malta: Add re-usable rng_seed_hex_new() method, Philippe Mathieu-Daudé, 2024/04/11
- [PATCH v2 01/13] ui/console-vc: Replace sprintf() by snprintf(), Philippe Mathieu-Daudé, 2024/04/11
- [PATCH v2 02/13] hw/vfio/pci: Replace sprintf() by snprintf(),
Philippe Mathieu-Daudé <=
- [PATCH v2 10/13] hw/scsi/scsi-disk: Use qemu_hexdump_line() to avoid sprintf(), Philippe Mathieu-Daudé, 2024/04/11
- [PATCH v2 03/13] hw/ppc/spapr: Replace sprintf() by snprintf(), Philippe Mathieu-Daudé, 2024/04/11
- [PATCH v2 05/13] hw/mips/malta: Replace sprintf() by snprintf(), Philippe Mathieu-Daudé, 2024/04/11
- [PATCH v2 13/13] backends/tpm: Use qemu_hexdump_line() to avoid sprintf(), Philippe Mathieu-Daudé, 2024/04/11
- [PATCH v2 12/13] hw/dma/pl330: Use qemu_hexdump_line() to avoid sprintf(), Philippe Mathieu-Daudé, 2024/04/11
- [PATCH v2 11/13] hw/ide/atapi: Use qemu_hexdump_line() to avoid sprintf(), Philippe Mathieu-Daudé, 2024/04/11