bug-bash
[Top][All Lists]
Advanced

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

Re: [PATCH] bash: fix error path of getc_with_restart()


From: Chet Ramey
Subject: Re: [PATCH] bash: fix error path of getc_with_restart()
Date: Tue, 29 Oct 2013 21:48:37 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.0.1

On 10/28/13, 10:51 PM, Yong Zhang wrote:
> When read() returns with ERROR, local_bufused will be set
> to -1; and if we return with local_bufused == -1 left,
> the next time we call getc_with_restart(), the condition
> (local_index == local_bufused || local_bufused == 0)
> will not match, thus we get random data from localbuf[]
> with local_index increased each time, eventually we may
> access data beyond array localbuf[]. Fix it by resetting
> local_index and local_bufused in case of read failure.

Thanks for the report.  This will cause a problem only in a small set of
circumstances: a read error in an interactive shell not using readline but
with ignoreeof set.  It will be fixed in the next bash release.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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