[Skiboot] [PATCH] Fix strcat onto uninit string for pci location code

Stewart Smith stewart at linux.vnet.ibm.com
Wed Oct 14 14:32:21 AEDT 2015


I don't *think* we've managed to hit this in the wild, although probably
largely by accident than anything on purpose.

Fix is to just explicitly set it to ''.

Fixes: 58ccf6a977ade80e4475d7d350c4c076ab1accad
Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 core/pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/core/pci.c b/core/pci.c
index 963d805..92ff2cf 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1151,6 +1151,8 @@ static void pci_add_slot_properties(struct phb *phb, struct pci_slot_info *info,
 	char loc_code[LOC_CODE_SIZE];
 	size_t base_loc_code_len = 0, slot_label_len = 0;
 
+	loc_code[0] = '\0';
+
 	if (phb->base_loc_code) {
 		base_loc_code_len = strlen(phb->base_loc_code);
 		strcpy(loc_code, phb->base_loc_code);
-- 
2.1.4



More information about the Skiboot mailing list