Skip to content

Commit e1d1c12

Browse files
committed
Avoid heap-buffer-overflow
bp-1 might not be readable when len == 0
1 parent 03ab346 commit e1d1c12

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/f-enbase.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@
443443
if (brk && ((count % 32) == 0)) *bp++ = LF;
444444
}
445445

446-
if (*(bp-1) != LF && (len >= 32) && brk) *bp++ = LF;
446+
if ((len >= 32) && brk && *(bp-1) != LF) *bp++ = LF;
447447
*bp = 0;
448448

449449
SERIES_TAIL(series) = DIFF_PTRS(bp, series->data);

0 commit comments

Comments
 (0)