martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.19k stars 259 forks source link

fix use after free in cmd_files() #1094

Closed rnpnr closed 1 year ago

rnpnr commented 1 year ago

When the cmd closes the window the window pointer gets freed along the way. We can't use win->next to update the loop variable if sam_execute() has been called. Instead we can store win->next early and use that variable to continue the loop.

fixes #1090

mcepl commented 1 year ago

+1 from me.

mcepl commented 1 year ago

Merged into https://git.sr.ht/~mcepl/vis/tree and after brief testing, it seems to be working.