[PATCH] DTC: Fix unprotected file name member access.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Signed-off-by: Jean-Christophe Dubois <jcd@xxxxxxxxxxxxxxx>
---
 srcpos.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpos.c b/srcpos.c
index af7fb3c..927ac54 100644
--- a/srcpos.c
+++ b/srcpos.c
@@ -252,7 +252,7 @@ void
 srcpos_dump(struct srcpos *pos)
 {
 	printf("file        : \"%s\"\n",
-	       pos->file ? (char *) pos->file : "<no file>");
+	       (pos->file && pos->file->name) ? pos->file->name : "<no file>");
 	printf("first_line  : %d\n", pos->first_line);
 	printf("first_column: %d\n", pos->first_column);
 	printf("last_line   : %d\n", pos->last_line);
@@ -267,7 +267,7 @@ srcpos_string(struct srcpos *pos)
 	const char *fname = "<no-file>";
 	char *pos_str;
 
-	if (pos)
+	if (pos->file && pos->file->name)
 		fname = pos->file->name;
 
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux