mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
libexpr: Fix read out-of-bound on the heap
Signed-off-by: Pamplemousse <xav.maso@gmail.com>
This commit is contained in:
parent
9cf991f421
commit
99f8fc995b
1 changed files with 4 additions and 2 deletions
|
@ -38,11 +38,13 @@ static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
|
||||||
loc->first_line = loc->last_line;
|
loc->first_line = loc->last_line;
|
||||||
loc->first_column = loc->last_column;
|
loc->first_column = loc->last_column;
|
||||||
|
|
||||||
while (len--) {
|
for (size_t i = 0; i < len; i++) {
|
||||||
switch (*s++) {
|
switch (*s++) {
|
||||||
case '\r':
|
case '\r':
|
||||||
if (*s == '\n') /* cr/lf */
|
if (*s == '\n') { /* cr/lf */
|
||||||
|
i++;
|
||||||
s++;
|
s++;
|
||||||
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case '\n':
|
case '\n':
|
||||||
++loc->last_line;
|
++loc->last_line;
|
||||||
|
|
Loading…
Reference in a new issue