*
* Returns: Zero if OK, nonzero if there wasn't a null byte to be found.
*
- * Use: Finds a terminating null byte.
+ * Use: Finds a terminating null byte. The length includes this
+ * terminator.
*/
static int findz(buf *b, size_t *nn)
buf_break(b);
return (-1);
}
- *nn = p - BCUR(b);
+ *nn = p - BCUR(b) + 1;
return (0);
}