Add (ugly?) code to prevent core dump as described in pr 5071 by Havard Eidnes.

XXX Maybe someone with more taste and understanding should have a look
XXX at this? At least I prefer this over the solution provided in the pr.
This commit is contained in:
frueauf 1998-09-14 11:52:21 +00:00
parent e325a47307
commit 988c143116

View File

@ -1,4 +1,4 @@
/* $NetBSD: displayq.c,v 1.13 1997/10/05 16:45:43 mrg Exp $ */
/* $NetBSD: displayq.c,v 1.14 1998/09/14 11:52:21 frueauf Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)displayq.c 8.4 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: displayq.c,v 1.13 1997/10/05 16:45:43 mrg Exp $");
__RCSID("$NetBSD: displayq.c,v 1.14 1998/09/14 11:52:21 frueauf Exp $");
#endif
#endif /* not lint */
@ -243,7 +243,10 @@ displayq(format)
if (cp - line > sizeof(line) - 1)
break;
*cp++ = ' ';
(void)strncpy(cp, user[i], line - cp - 1);
if (line - cp - 1 >= 0)
(void)strncpy(cp, user[i], line - cp - 1);
else
(void)strcpy(cp, user[i]);
}
(void)strncat(line, "\n", sizeof(line) - strlen(line) - 1);
fd = getport(RM, 0);