[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch] potentially uninitialized variable in rl_generic_bind
From: |
Chet Ramey |
Subject: |
Re: [Patch] potentially uninitialized variable in rl_generic_bind |
Date: |
Fri, 24 May 2019 09:30:02 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
On 5/24/19 4:14 AM, Adam Richter wrote:
> cppcheck noticed that, in the file lib/readline/bind.c, the function
> rl_generic_bind contains a loop that declares a variable named ic in
> the loop body, and relies on that variable being initialized with its
> value from the previous iteration (in the line "prevkey = ic;"), which
> is not something that the compiler guarantees. This patch lifts the
> declaration of ic outside the loop to ensure that its value is
> preserved across those iterations.
Thanks for the report.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/