try to allocate a charstring_t of length INT_MAX with -width 0.
if ((width = sc_width ()) < WIDTH / 2) {
/* Default: width of the terminal, but at least WIDTH/2. */
width = WIDTH / 2;
- } else if (width == 0) {
- /* Unlimited width. */
- width = INT_MAX;
}
width -= 2;
+ } else if (width == 0) {
+ /* Unlimited width. */
+ width = INT_MAX;
}
fmt_compile (nfs, &fmt, 1);
}
for (p = pq.pq_next; p; p = q) {
- charstring_t scanl = charstring_create (length);
+ charstring_t scanl =
+ charstring_create (length < NMH_BUFSIZ ? length : NMH_BUFSIZ);
cptr = fmt_findcomp ("text");
if (cptr) {
if (cptr->c_text)
- free(cptr->c_text);
+ free(cptr->c_text);
cptr->c_text = p->pq_text;
p->pq_text = NULL;
}
cptr = fmt_findcomp ("error");
if (cptr) {
if (cptr->c_text)
- free(cptr->c_text);
+ free(cptr->c_text);
cptr->c_text = p->pq_error;
p->pq_error = NULL;
}
if ((width = sc_width ()) < WIDTH / 2) {
/* Default: width of the terminal, but at least WIDTH/2. */
width = WIDTH / 2;
- } else if (width == 0) {
- /* Unlimited width. */
- width = INT_MAX;
}
width -= 2;
+ } else if (width == 0) {
+ /* Unlimited width. */
+ width = INT_MAX;
}
fmt_compile (nfs, &fmt, 1);
process (char *date, int length)
{
int status = 0;
- charstring_t scanl = charstring_create (length);
+ charstring_t scanl =
+ charstring_create (length < NMH_BUFSIZ ? length : NMH_BUFSIZ);
register struct comp *cptr;
cptr = fmt_findcomp ("text");
width = INT_MAX;
}
dat[3] = slwidth = width;
- *scanl = charstring_create (width);
+ *scanl = charstring_create (width < NMH_BUFSIZ ? width : NMH_BUFSIZ);
if (outnum)
umask(~m_gmprot());