On Thu, Jun 30, 2011 at 2:57 AM, Fam Zheng <famc...@gmail.com> wrote:
> On Wed, Jun 29, 2011 at 11:57 PM, Stefan Hajnoczi <stefa...@gmail.com> wrote:
>> On Tue, Jun 28, 2011 at 2:32 AM, Fam Zheng <famc...@gmail.com> wrote:
>>> +        /* trim the quotation marks around */
>>> +        if (fname[0] == '"') {
>>> +            memmove(fname, fname + 1, strlen(fname) + 1);
>>
>> This copies 1 byte too many, just strlen(fname) will do.
> I meant to copy the NULL terminator too.

Yes.  The problem is the copying starts at fname + 1 but strlen(3)
starts at fname.  So there is already an extra byte.  The + 1 adds an
additional byte after the NUL.


Stefan

Reply via email to