diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2017-03-18 18:10:02 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2017-03-18 18:10:02 +0100 |
commit | 0fa7f352fc954b79f2d734a5c1c276df5dd1ffd3 (patch) | |
tree | 4680dbdeb685deed7733d3357d7fbcd5f779ead2 | |
parent | 2201497fdee0af3f14c6a8df85279f89a4b9c835 (diff) | |
download | plan9port-0fa7f352fc954b79f2d734a5c1c276df5dd1ffd3.tar.gz plan9port-0fa7f352fc954b79f2d734a5c1c276df5dd1ffd3.tar.bz2 plan9port-0fa7f352fc954b79f2d734a5c1c276df5dd1ffd3.zip |
Fix key down buffer overflow bug at EOF
-rw-r--r-- | src/cmd/acme/text.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c index 21810860..be32ad76 100644 --- a/src/cmd/acme/text.c +++ b/src/cmd/acme/text.c @@ -682,13 +682,13 @@ texttype(Text *t, Rune r) return; case Kdown: typecommit(t); + q0 = t->q0; nnb = 0; - if(t->q0>0 && textreadc(t, t->q0-1)!='\n') + if(q0>0 && textreadc(t, q0-1)!='\n') nnb = textbswidth(t, 0x15); - q0 = t->q0; while(q0<t->file->b.nc && textreadc(t, q0)!='\n') q0++; - if (q0+1 != t->file->b.nc) + if (q0+1 < t->file->b.nc) q0++; while(q0<t->file->b.nc && textreadc(t, q0)!='\n' && nnb--) q0++; |