[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-readline] Memory error in read_history_range
From: |
Chet Ramey |
Subject: |
Re: [Bug-readline] Memory error in read_history_range |
Date: |
Thu, 16 Mar 2017 15:32:08 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 |
On 3/16/17 12:41 AM, Denis Martinez wrote:
> An error occurs because buffer is assumed to be a 0-terminated string,
> however it is not.
>
> The code which previously reads into buffer does not write the 0 terminator
> after the data. This problem could be solved by writing
> `buffer[chars_read] = 0' in the success path following read().
>
> Please also note: the MMAP path, which also does not terminate input,
> seems equally fallible given an input whose exact content is the character #.
Thanks for the report. This looks like a good fix.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/