diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-12-08 16:47:59 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-12-08 16:47:59 -0800 |
commit | 8a70fbd17140e9f30bd281b0f6b7eb04ef2c6def (patch) | |
tree | 5d6874368ba51e7488ff50ee394817e6646379e7 /src | |
parent | 71ce944e816b7e3de4b1ea6ae67f595d09960b4d (diff) | |
download | teliva-8a70fbd17140e9f30bd281b0f6b7eb04ef2c6def.tar.gz |
fix a use-after-free
Introduced Nov 28. Let's see if my intermittent segfaults stop now.
Diffstat (limited to 'src')
-rw-r--r-- | src/kilo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/kilo.c b/src/kilo.c index b0d04a0..2635778 100644 --- a/src/kilo.c +++ b/src/kilo.c @@ -1070,10 +1070,10 @@ static void editorProcessKeypress(lua_State* L) { switch(c) { case ENTER: { - erow* oldrow = &E.row[E.rowoff + E.cy]; editorInsertNewline(); /* auto-indent */ - for (int x = 0; x < oldrow->size && oldrow->chars[x] == ' '; ++x) + erow* prevrow = &E.row[E.rowoff + E.cy - 1]; + for (int x = 0; x < prevrow->size && prevrow->chars[x] == ' '; ++x) editorInsertChar(' '); } break; |