Skip to content

Commit 7a21c79

Browse files
authored
Fix heap-buffer-overflow in re_linebreak (#3057)
Fixes #3056
1 parent 6e7ab55 commit 7a21c79

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lexer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ namespace Sass {
9393
const char* re_linebreak(const char* src)
9494
{
9595
// end of file or unix linefeed return here
96-
if (*src == 0 || *src == '\n' || *src == '\f') return src + 1;
96+
if (*src == 0) return src;
97+
// end of file or unix linefeed return here
98+
if (*src == '\n' || *src == '\f') return src + 1;
9799
// a carriage return may optionally be followed by a linefeed
98100
if (*src == '\r') return *(src + 1) == '\n' ? src + 2 : src + 1;
99101
// no linefeed

0 commit comments

Comments
 (0)