[PATCH] show_parse: avoid null pointer dereference in do_show_type()

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

 



do_show_type() checks sym->type inside the "if (!sym || ...)" block.

While at it, remove the trailing whitespaces.

Fixes: 0fe7ebb9 ("show-parse: do not display base type's redundant specifiers")
Reported-by: Alexey Gladkov <gladkov.alexey@xxxxxxxxx>
Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
---
 show-parse.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/show-parse.c b/show-parse.c
index f0ea9ca..044465e 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -300,12 +300,12 @@ deeper:
 		if (as)
 			prepend(name, "%s ", show_as(as));
 
-		if (sym->type == SYM_BASETYPE || sym->type == SYM_ENUM)
+		if (sym && (sym->type == SYM_BASETYPE || sym->type == SYM_ENUM))
 			mod &= ~MOD_SPECIFIER;
 		s = modifier_string(mod);
 		len = strlen(s);
-		name->start -= len;    
-		memcpy(name->start, s, len);  
+		name->start -= len;
+		memcpy(name->start, s, len);
 		mod = 0;
 		as = NULL;
 	}
-- 
2.5.0






[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux