Skip to content

Commit

Permalink
Fixed potential nullpointer de-reference in the buffer-get-bline-w-hi…
Browse files Browse the repository at this point in the history
…nt function
  • Loading branch information
proh14 authored and adsr committed Nov 15, 2024
1 parent 3e2654c commit 7a5e097
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ int buffer_get_bline_w_hint(buffer_t *self, bint_t line_index, bline_t *opt_hint

if (!opt_hint) {
opt_hint = self->first_line;
if (!opt_hint) { // Satisfy scan-build lint
*ret_bline = NULL;
return MLBUF_ERR;
}
}

fwd = opt_hint;
Expand Down Expand Up @@ -1406,6 +1410,11 @@ static int _buffer_redo(buffer_t *self, int by_group) {
// Get line to perform undo on
bline = NULL;
buffer_get_bline(self, action_to_redo->start_line_index, &bline);

if (!bline){
return MLBUF_ERR;
}

MLBUF_BLINE_ENSURE_CHARS(bline);
if (!bline) {
return MLBUF_ERR;
Expand Down

0 comments on commit 7a5e097

Please sign in to comment.