Skip to content

Commit db842b5

Browse files
zsxOldes
authored andcommitted
ATRONIX/FIX: Avoid heap-buffer-overflow
bp-1 might not be readable when len == 0 (cherry picked from commit e1d1c12)
1 parent c2dfd09 commit db842b5

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
@@ -609,7 +609,7 @@
609609
if (brk && ((count % 32) == 0)) *bp++ = LF;
610610
}
611611

612-
if (*(bp-1) != LF && (len >= 32) && brk) *bp++ = LF;
612+
if ((len >= 32) && brk && *(bp-1) != LF) *bp++ = LF;
613613
*bp = 0;
614614

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

0 commit comments

Comments
 (0)