🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.2bsd
Article #26

lpd long file bug

#26
From: Steven M. Schultz
Date: Fri, 25 Aug 1989 05:59
52 lines
1863 bytes
Subject: lpd long file bug
Index:	usr.lib/lpr/printjob.c 2.10BSD

Description:
	two more "long" vs. "int" gotchas have surfaced in the "lpd"
	program.  one of these days the last of these long/int bugs
	will be terminated!

Repeat-By:
	by examination and trying to print a file longer than 32kb.

Fix:
	Apply the following patch to lpr/printjob.c


*** printjob.c.old	Sun Dec 25 23:52:14 1988
--- printjob.c	Thu Aug 24 11:15:14 1989
***************
*** 705,711 ****
  sendfile(type, file)
  	char type, *file;
  {
! 	register int f, i, amt;
  	struct stat stb;
  	char buf[BUFSIZ];
  	int sizerr, resp;
--- 705,712 ----
  sendfile(type, file)
  	char type, *file;
  {
! 	register int f, amt;
! 	long i;
  	struct stat stb;
  	char buf[BUFSIZ];
  	int sizerr, resp;
***************
*** 720,726 ****
  	if ((stb.st_mode & S_IFMT) == S_IFLNK && fstat(f, &stb) == 0 &&
  	    (stb.st_dev != fdev || stb.st_ino != fino))
  		return(ACCESS);
! 	(void) sprintf(buf, "%c%d %s\n", type, stb.st_size, file);
  	amt = strlen(buf);
  	for (i = 0;  ; i++) {
  		if (write(pfd, buf, amt) != amt ||
--- 721,727 ----
  	if ((stb.st_mode & S_IFMT) == S_IFLNK && fstat(f, &stb) == 0 &&
  	    (stb.st_dev != fdev || stb.st_ino != fino))
  		return(ACCESS);
! 	(void) sprintf(buf, "%c%ld %s\n", type, stb.st_size, file);
  	amt = strlen(buf);
  	for (i = 0;  ; i++) {
  		if (write(pfd, buf, amt) != amt ||
Technical Details
Message-ID: <35476@wlbr.IMSD.CONTEL.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!mahendo!wlbr!wlv!sms

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!mahendo!wlbr!wlv!sms
From: sms@wlv.imsd.contel.com (Steven M. Schultz)
Newsgroups: comp.bugs.2bsd
Subject: lpd long file bug
Message-ID: <35476@wlbr.IMSD.CONTEL.COM>
Date: 25 Aug 89 05:59:17 GMT
Sender: news@wlbr.IMSD.CONTEL.COM
Reply-To: sms@wlv.imsd.contel.com (Steven M. Schultz)
Organization: Contel Federal Systems
Lines: 52