Message ID | 20200116174838.GA32100@redhat.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | show_parse: avoid null pointer dereference in do_show_type() | expand |
On Thu, Jan 16, 2020 at 06:48:38PM +0100, Oleg Nesterov wrote: > do_show_type() checks sym->type inside the "if (!sym || ...)" block. > > While at it, remove the trailing whitespaces. Thank you! Applied and pushed. -- Luc
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; }
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@gmail.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com> --- show-parse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)