mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Jesper Juhl" <jesper.juhl@gmail.com>
Cc: "Richard Henderson" <rth@tamu.edu>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Avoid potential NULL deref in scripts/genksyms/lex.l
Date: Sun, 24 Jun 2007 16:00:14 -0700	[thread overview]
Message-ID: <20070624160014.84e26d35.akpm@linux-foundation.org> (raw)
In-Reply-To: <9a8748490706241502j217a5c6drd015dcd84633ab3a@mail.gmail.com>

On Mon, 25 Jun 2007 00:02:03 +0200 "Jesper Juhl" <jesper.juhl@gmail.com> wrote:

> > > +      if (!file || !e)
> > > +     exit(1);
> > >        *e = '\0';
> > >        cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1);
> > >        cur_line = atoi(yytext+2);
> >
> > I don't think the bug which you're fixing can occur:
> >
> > ^#[ \t]+{INT}[ \t]+\"[^\"\n]+\".*\n     return FILENAME;
> >
> > has anyone reported crashes in there?
> >
> 
> It may indeed not be possible. Found by inspection, not by any actual
> observed crashes.
> But does it really hurt to be defensive here? In case it can somehow
> be caused to fail, with my patch it'll fail a bit nicer :) It's not
> like it's at all speed critical code that will be hurt by that extra
> 'if'...

We can only get NULL pointers here if the regexp is wrong or if there's
a bug in the regexp parser.  Getting a coredump at the failure site is
much better behaviour than mysteriously exiting.

  reply	other threads:[~2007-06-24 23:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-24 21:40 Jesper Juhl
2007-06-24 21:58 ` Andrew Morton
2007-06-24 22:02   ` Jesper Juhl
2007-06-24 23:00     ` Andrew Morton [this message]
2007-06-24 23:08       ` Jesper Juhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070624160014.84e26d35.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rth@tamu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®