summaryrefslogtreecommitdiff
path: root/usr.sbin/lpr/common_source/displayq.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/lpr/common_source/displayq.c')
-rw-r--r--usr.sbin/lpr/common_source/displayq.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/lpr/common_source/displayq.c b/usr.sbin/lpr/common_source/displayq.c
index 7a1282b8ee4..503a7c43f4f 100644
--- a/usr.sbin/lpr/common_source/displayq.c
+++ b/usr.sbin/lpr/common_source/displayq.c
@@ -225,13 +225,14 @@ displayq(format)
*/
if (nitems)
putchar('\n');
- (void) sprintf(line, "%c%s", format + '\3', RP);
+ (void) snprintf(line, sizeof line, "%c%s", format + '\3', RP);
cp = line;
- for (i = 0; i < requests; i++) {
+ for (i = 0; i < requests && cp-line+10 < sizeof line; i++) {
cp += strlen(cp);
(void) sprintf(cp, " %d", requ[i]);
}
- for (i = 0; i < users; i++) {
+ for (i = 0; i < users && cp-line+1+strlen(user[i]) <
+ sizeof line; i++) {
cp += strlen(cp);
*cp++ = ' ';
(void) strcpy(cp, user[i]);