Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1519954

Re: [PATCH v2 2/4] printk/kdb: Handle more message headers

From Petr Mladek <pmladek@suse.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/4] printk/kdb: Handle more message headers
Date 2016-11-11 19:20 +0100
Message-ID <sCoAG-7P3-19@gated-at.bofh.it> (permalink)
References <sBAud-7n4-3@gated-at.bofh.it> <sBAue-7n4-17@gated-at.bofh.it> <sCnXY-7h4-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri 2016-11-11 12:35:13, Steven Rostedt wrote:
> On Wed,  9 Nov 2016 13:41:29 +0100
> Petr Mladek <pmladek@suse.com> wrote:
> 
> > diff --git a/include/linux/printk.h b/include/linux/printk.h
> > index eac1af8502bb..a0859e169bc3 100644
> > --- a/include/linux/printk.h
> > +++ b/include/linux/printk.h
> > @@ -31,6 +31,14 @@ static inline const char *printk_skip_level(const char *buffer)
> >  	return buffer;
> >  }
> >  
> > +static inline const char *printk_skip_headers(const char *buffer)
> > +{
> > +	while (printk_get_level(buffer))
> > +		buffer = printk_skip_level(buffer);
> 
> Hmm, shouldn't there be a length passed in here. What happens if buffer
> ends with a header. Can't this overflow?

It is OK when the string has the trailing '\0'. This is the case here.

Note that printk_skip_level() and printk_get_level() would have the
same problem if only the first byte of the header fit the buffer.

Best Regards,
Petr

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] printk: Fixes and hardening related to KERN_CONT Petr Mladek <pmladek@suse.com> - 2016-11-09 13:50 +0100
  [PATCH v2 3/4] printk/btrfs: Handle more message headers Petr Mladek <pmladek@suse.com> - 2016-11-09 13:50 +0100
    Re: [PATCH v2 3/4] printk/btrfs: Handle more message headers David Sterba <dsterba@suse.cz> - 2016-11-10 14:30 +0100
    Re: [PATCH v2 3/4] printk/btrfs: Handle more message headers Steven Rostedt <rostedt@goodmis.org> - 2016-11-11 18:50 +0100
      Re: [PATCH v2 3/4] printk/btrfs: Handle more message headers Petr Mladek <pmladek@suse.com> - 2016-11-11 19:20 +0100
  [PATCH v2 2/4] printk/kdb: Handle more message headers Petr Mladek <pmladek@suse.com> - 2016-11-09 13:50 +0100
    Re: [PATCH v2 2/4] printk/kdb: Handle more message headers Steven Rostedt <rostedt@goodmis.org> - 2016-11-11 18:40 +0100
      Re: [PATCH v2 2/4] printk/kdb: Handle more message headers Petr Mladek <pmladek@suse.com> - 2016-11-11 19:20 +0100
  [PATCH v2 1/4] printk/NMI: Handle continuous lines and missing newline Petr Mladek <pmladek@suse.com> - 2016-11-09 13:50 +0100
    Re: [PATCH v2 1/4] printk/NMI: Handle continuous lines and missing  newline Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-11-11 01:30 +0100
    Re: [PATCH v2 1/4] printk/NMI: Handle continuous lines and missing  newline Steven Rostedt <rostedt@goodmis.org> - 2016-11-11 18:30 +0100
      Re: [PATCH v2 1/4] printk/NMI: Handle continuous lines and missing  newline Petr Mladek <pmladek@suse.com> - 2016-11-11 19:10 +0100

csiph-web