Current-Users archive

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

Re: strndup returning an address out of bounds



On Wed, 12 Mar 2008, Christos Zoulas wrote:

> In article <Pine.NEB.4.64.0803121125280.360%tx.reedmedia.net@localhost>,
> Jeremy C. Reed <reed%reedmedia.net@localhost> wrote:
> >Trying to get svn version of netsurf running on
> >4.99.55 on amd64.
> >
> >So I have:
> >
> >Breakpoint 3, fetchcache_parse_type (
> >    s=0x7f7ff4c07c00 "text/html; charset=ISO-8859-1", 
> >params=0x7f7fffffb2e8)
> >    at content/fetchcache.c:576
> >576             type = strndup(s + pmatch[1].rm_so, pmatch[1].rm_eo -
> >pmatch[1].rm_so);
> >
> >(gdb) print out pmatch[1]
> >No symbol "out" in current context.
> >
> >(gdb) print  pmatch[1]
> >$6 = {rm_so = 0, rm_eo = 9}
> >
> >Attempting to step into strndup:
> >
> >(gdb) step
> >577             if (!type) {
> >
> >Didn't step in, so suggests it's in the C library  -- it is.
> >
> >(gdb) print type
> >$7 = 0xfffffffff4d51150 <Address 0xfffffffff4d51150 out of bounds>
> >(gdb)
> >    
> >
> >What would cause that Address 0xfffffffff4d51150 out of bounds?
> >
> >Any clues on how that could be returned by strndup?
> 
> Looks like the prototype is not in scope.

I don't understand.

The problem was fixed by defining _NETBSD_SOURCE.

Should the strndup manpage mention that?

(The netsurf developer saw by reading our string.h.)

  Jeremy C. Reed


Home | Main Index | Thread Index | Old Index