=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/man_term.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- src/usr.bin/mandoc/man_term.c 2010/07/25 18:05:54 1.45 +++ src/usr.bin/mandoc/man_term.c 2010/09/21 22:33:41 1.46 @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.45 2010/07/25 18:05:54 schwarze Exp $ */ +/* $Id: man_term.c,v 1.46 2010/09/21 22:33:41 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -911,6 +911,10 @@ p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; p->rmargin = p->maxrmargin - term_strlen(p, buf); p->offset = 0; + + /* term_strlen() can return zero. */ + if (p->rmargin == p->maxrmargin) + p->rmargin--; if (meta->source) term_word(p, meta->source);