SCCS-vsn: usr.sbin/lpr/lpd/printjob.c 4.15
-static char sccsid[] = "@(#)printjob.c 4.14 (Berkeley) %G%";
+static char sccsid[] = "@(#)printjob.c 4.15 (Berkeley) %G%";
static char fromhost[32]; /* user's host machine */
static char logname[32]; /* user's login name */
static char fromhost[32]; /* user's host machine */
static char logname[32]; /* user's login name */
-static char jobname[32]; /* job or file name */
+static char jobname[100]; /* job or file name */
static char class[32]; /* classification field */
static char width[10] = "-w"; /* page width in characters */
static char length[10] = "-l"; /* page length in lines */
static char class[32]; /* classification field */
static char width[10] = "-w"; /* page width in characters */
static char length[10] = "-l"; /* page length in lines */
case 'H':
strcpy(fromhost, line+1);
if (class[0] == '\0')
case 'H':
strcpy(fromhost, line+1);
if (class[0] == '\0')
+ strncpy(class, line+1, sizeof(class)-1);
- strcpy(logname, line+1);
+ strncpy(logname, line+1, sizeof(logname)-1);
if (RS) { /* restricted */
if (getpwnam(logname) == (struct passwd *)0) {
bombed = 2;
if (RS) { /* restricted */
if (getpwnam(logname) == (struct passwd *)0) {
bombed = 2;
case 'J':
if (line[1] != '\0')
case 'J':
if (line[1] != '\0')
- strcpy(jobname, line+1);
+ strncpy(jobname, line+1, sizeof(jobname)-1);
else
strcpy(jobname, " ");
continue;
case 'C':
if (line[1] != '\0')
else
strcpy(jobname, " ");
continue;
case 'C':
if (line[1] != '\0')
+ strncpy(class, line+1, sizeof(class)-1);
else if (class[0] == '\0')
gethostname(class, sizeof (class));
continue;
case 'T': /* header title for pr */
else if (class[0] == '\0')
gethostname(class, sizeof (class));
continue;
case 'T': /* header title for pr */
+ strncpy(title, line+1, sizeof(title)-1);
continue;
case 'L': /* identification line */
continue;
case 'L': /* identification line */
continue;
case 'W': /* page width */
continue;
case 'W': /* page width */
- strcpy(width+2, line+1);
+ strncpy(width+2, line+1, sizeof(width)-3);
continue;
case 'I': /* indent amount */
continue;
case 'I': /* indent amount */
- strcpy(indent+2, line+1);
+ strncpy(indent+2, line+1, sizeof(indent)-3);
continue;
default: /* some file to print */
continue;
default: /* some file to print */