Commit 74da2fad authored by Ziye Yang's avatar Ziye Yang Committed by Daniel Verkamp
Browse files

Replace sprintf with snprintf in several files



Change-Id: I2a46433e81e605e57df4b2a1a9c1c27097333d0c
Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
parent 228a81f1
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ spdk_pci_device_get_serial_number(struct spdk_pci_device *dev, char *sn, size_t
					if (err)
						return -1;
				}
				sprintf(sn, "%08x%08x", buf[1], buf[0]);
				snprintf(sn, len, "%08x%08x", buf[1], buf[0]);
				return 0;
			}
		}
@@ -404,7 +404,8 @@ spdk_pci_device_claim(const struct spdk_pci_addr *pci_addr)
		.l_len = 0,
	};

	sprintf(shm_name, PCI_PRI_FMT, pci_addr->domain, pci_addr->bus, pci_addr->dev, pci_addr->func);
	snprintf(shm_name, sizeof(shm_name), PCI_PRI_FMT, pci_addr->domain, pci_addr->bus, pci_addr->dev,
		 pci_addr->func);

	dev_fd = shm_open(shm_name, O_RDWR | O_CREAT, 0600);
	if (dev_fd == -1) {
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ config_file_fail_cases(void)

	section_index = 0;
	while (true) {
		sprintf(section_name, "Failure%d", section_index);
		snprintf(section_name, sizeof(section_name), "Failure%d", section_index);
		sp = spdk_conf_find_section(config, section_name);
		if (sp == NULL) {
			break;