replace magic calcuation with one based on the size of the array. -1 to account for the trailing zero element, which is clearly not a real register. Notes: Fri Jan 4 17:27:37 EST 2013 geoff already done differently. Reference: /n/sources/patch/sorry/tblbad Date: Fri Jan 4 17:02:41 CET 2013 Signed-off-by: quanstro@quanstro.net Reviewed-by: geoff --- /sys/src/cmd/tbl/tr.c Fri Jan 4 17:02:11 2013 +++ /sys/src/cmd/tbl/tr.c Fri Jan 4 17:02:10 2013 @@ -20,7 +20,7 @@ char * reg(int col, int place) { - if (sizeof(nregs) < 2 * 3 * qcol) + if(qcol*place+col >= nelem(nregs)-1) error("Too many columns for registers"); return (nregs[qcol*place+col]); }