[Skiboot] [PATCH 1/6] external/gard: Fix Coverity defect 107467
Cyril Bur
cyril.bur at au1.ibm.com
Tue Sep 8 16:13:58 AEST 2015
Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
external/gard/gard.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/external/gard/gard.c b/external/gard/gard.c
index fec3101..5af80d9 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -277,12 +277,13 @@ static int get_dev_mtd(const char *fdt_flash_path, char **r_path)
return -1;
}
- rc = read(fd, fdt_node_path, sizeof(fdt_node_path));
+ rc = read(fd, fdt_node_path, sizeof(fdt_node_path) - 1);
close(fd);
if (rc == -1) {
fprintf(stderr, "Couldn't read flash FDT node from '%s'\n", fdt_flash_path);
return -1;
}
+ fdt_node_path[rc] = '\0';
count = scandir(SYSFS_MTD_PATH, &namelist, NULL, alphasort);
if (count == -1) {
--
2.5.1
More information about the Skiboot
mailing list