ref: 17a92f3995976b5d7618d1a2442e0028c1b192de
parent: adb36de077c9bcd99072e86c7f84bac46a58e326
author: cinap_lenrek <[email protected]>
date: Fri Feb 28 11:48:42 EST 2020
devproc: make sure writewatchpt() doesnt overflow the watchpoint array the user buffer could be changed while we parse it resulting in a different number of watchpoints than initially calculated. so add a check to the parse loop so we wont overflow the watchpoint array.
--- a/sys/src/9/port/devproc.c
+++ b/sys/src/9/port/devproc.c
@@ -812,7 +812,7 @@
}
if(nwp0 > 0)
memmove(wp, pr->watchpt, sizeof(Watchpt) * nwp0);
- for(wq = wp + nwp0;;){
+ for(wq = wp + nwp0; wq < wp + nwp0+nwp;){
q = memchr(p, '\n', e - p);
if(q == nil)
break;