emacs-devel
[Top][All Lists]
Advanced

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

Re: Willing to debug bug #3542 (23.0.94; File access via UNC path slow a


From: Stefan Monnier
Subject: Re: Willing to debug bug #3542 (23.0.94; File access via UNC path slow again under Windows)
Date: Mon, 13 Jul 2009 20:54:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.94 (gnu/linux)

> Aha.  But it sounds like it's not just me who is confused.  Here's
> just two examples:

>   From doc.c:

>       strp = SDATA (string);
>       while (strp < SDATA (string) + SBYTES (string))

>   (why not "while *strp"?)

As said Andreas, this would stop at the first NUL, which may appear
within the string.

>   From fileio.c:
>       nm = (unsigned char *) alloca (SBYTES (filename) + 1);
>       bcopy (SDATA (filename), nm, SBYTES (filename) + 1);
>   (why +1? it potentially accesses memory beyond end of `filename's
>   contents)

The +1 is precisely used to make sure we copy the terminating NUL.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]