Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jun 2000 13:11:48 -0700 (PDT)
From:      john@zoner.org
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/19180: Hylafax security patch
Message-ID:  <20000610201148.9025137B586@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         19180
>Category:       ports
>Synopsis:       Hylafax security patch
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jun 10 13:20:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     John Holland
>Release:        4.0-STABLE
>Organization:
>Environment:
FreeBSD bilbo.zoner.org 4.0-STABLE FreeBSD 4.0-STABLE #1: Fri May 12 23:04:46 EDT 2000     toor@bilbo.zoner.org:/usr/src/sys/compile/BILBO  i386

>Description:
Patch of numerous unbounded char string copies, including the setuid uucp buffer overflow in faxalter.
>How-To-Repeat:
comms/hylafax port is marked FORBIDDEN
>Fix:
diff -cr ./faxalter/faxalter.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxalter/faxalter.c++
*** ./faxalter/faxalter.c++	Sat Feb 14 05:48:38 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxalter/faxalter.c++	Fri Jun  9 15:01:00 2000
***************
*** 185,191 ****
      va_list ap;
      va_start(ap, fmt0);
      char fmt[1024];
!     sprintf(fmt, "%s %s\n", groups ? "JGPARM" : "JPARM", fmt0);
      script.append(fxStr::vformat(fmt, ap));
      va_end(ap);
  }
--- 185,191 ----
      va_list ap;
      va_start(ap, fmt0);
      char fmt[1024];
!     snprintf(fmt, 1024, "%s %s\n", groups ? "JGPARM" : "JPARM", fmt0);
      script.append(fxStr::vformat(fmt, ap));
      va_end(ap);
  }
diff -cr ./faxd/ClassModem.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/ClassModem.c++
*** ./faxd/ClassModem.c++	Sat Feb 14 05:49:16 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/ClassModem.c++	Fri Jun  9 15:45:00 2000
***************
*** 169,175 ****
  {
      protoTrace("DIAL %s", number);
      char buf[256];
!     sprintf(buf, (const char*) conf.dialCmd, number);
      emsg = "";
      CallStatus cs = (atCmd(buf, AT_NOTHING) ? dialResponse(emsg) : FAILURE);
      if (cs != OK && emsg == "")
--- 169,175 ----
  {
      protoTrace("DIAL %s", number);
      char buf[256];
!     snprintf(buf, 256, (const char*) conf.dialCmd, number);
      emsg = "";
      CallStatus cs = (atCmd(buf, AT_NOTHING) ? dialResponse(emsg) : FAILURE);
      if (cs != OK && emsg == "")
diff -cr ./faxd/FaxMachineLog.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/FaxMachineLog.c++
*** ./faxd/FaxMachineLog.c++	Sat Feb 14 05:49:21 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/FaxMachineLog.c++	Fri Jun  9 15:42:56 2000
***************
*** 77,83 ****
      timeval tv;
      (void) gettimeofday(&tv, 0);
      strftime(buf, sizeof (buf), "%h %d %T", localtime((time_t*) &tv.tv_sec));
!     sprintf(buf+strlen(buf), ".%02u: [%5d]: ", tv.tv_usec / 10000, pid);
      /*
       * Copy format string into a local buffer so
       * that we can substitute for %m, a la syslog.
--- 77,83 ----
      timeval tv;
      (void) gettimeofday(&tv, 0);
      strftime(buf, sizeof (buf), "%h %d %T", localtime((time_t*) &tv.tv_sec));
!     snprintf(buf+strlen(buf), (16*1024)-strlen(buf), ".%02u: [%5d]: ", tv.tv_usec / 10000, pid);
      /*
       * Copy format string into a local buffer so
       * that we can substitute for %m, a la syslog.
***************
*** 96,101 ****
  	fmt.put(fp[0]);
      }
      fmt.put('\n'); fmt.put('\0');
!     vsprintf(buf+strlen(buf), (const char*) fmt, ap);
      (void) Sys::write(fd, buf, strlen(buf));
  }
--- 96,101 ----
  	fmt.put(fp[0]);
      }
      fmt.put('\n'); fmt.put('\0');
!     vsnprintf(buf+strlen(buf), (16*1024)-strlen(buf), (const char*) fmt, ap);
      (void) Sys::write(fd, buf, strlen(buf));
  }
diff -cr ./faxd/FaxRecv.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/FaxRecv.c++
*** ./faxd/FaxRecv.c++	Sat Feb 14 05:49:23 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/FaxRecv.c++	Fri Jun  9 15:43:55 2000
***************
*** 139,145 ****
  	 * number file to reflect the allocation.
  	 */
  	(void) flock(ftmp, LOCK_EX|LOCK_NB);
! 	sprintf(line, "%u", seqnum);
  	(void) lseek(fseqf, 0, SEEK_SET);
  	if (Sys::write(fseqf, line, strlen(line)) != strlen(line) ||
  		ftruncate(fseqf,strlen(line))) {
--- 139,145 ----
  	 * number file to reflect the allocation.
  	 */
  	(void) flock(ftmp, LOCK_EX|LOCK_NB);
! 	snprintf(line, 16, "%u", seqnum);
  	(void) lseek(fseqf, 0, SEEK_SET);
  	if (Sys::write(fseqf, line, strlen(line)) != strlen(line) ||
  		ftruncate(fseqf,strlen(line))) {
diff -cr ./faxd/FaxRequest.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/FaxRequest.c++
*** ./faxd/FaxRequest.c++	Sat Feb 14 05:49:24 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/FaxRequest.c++	Fri Jun  9 15:40:06 2000
***************
*** 679,685 ****
  FaxRequest::error(const char* fmt0 ...)
  {
      char fmt[128];
!     sprintf(fmt, "%s: line %u: %s", (const char*) qfile, (u_int) lineno, fmt0);
      va_list ap;
      va_start(ap, fmt0);
      vlogError(fmt, ap);
--- 679,685 ----
  FaxRequest::error(const char* fmt0 ...)
  {
      char fmt[128];
!     snprintf(fmt, 128, "%s: line %u: %s", (const char*) qfile, (u_int) lineno, fmt0);
      va_list ap;
      va_start(ap, fmt0);
      vlogError(fmt, ap);
diff -cr ./faxd/Job.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/Job.c++
*** ./faxd/Job.c++	Sat Feb 14 05:49:32 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/Job.c++	Fri Jun  9 15:39:26 2000
***************
*** 171,177 ****
  #define	N(a)	(sizeof (a) / sizeof (a[0]))
      if ((u_int) status >= N(names)) {
  	static char s[30];
! 	sprintf(s, "status_%u", (u_int) status);
  	return (s);
      } else
  	return (names[status]);
--- 171,177 ----
  #define	N(a)	(sizeof (a) / sizeof (a[0]))
      if ((u_int) status >= N(names)) {
  	static char s[30];
! 	snprintf(s, 30, "status_%u", (u_int) status);
  	return (s);
      } else
  	return (names[status]);
diff -cr ./faxd/ModemServer.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/ModemServer.c++
*** ./faxd/ModemServer.c++	Sat Feb 14 05:49:34 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/ModemServer.c++	Fri Jun  9 15:38:47 2000
***************
*** 604,610 ****
  	} while (ftmp < 0 && errno == EEXIST && --ntry >= 0);
  	umask(omask);
  	if (ftmp >= 0) {
! 	    sprintf(line, "%u", seqnum);
  	    (void) lseek(fseqf, 0, SEEK_SET);
  	    if (Sys::write(fseqf, line, strlen(line)) != strlen(line) ||
  		ftruncate(fseqf,strlen(line)))
--- 604,610 ----
  	} while (ftmp < 0 && errno == EEXIST && --ntry >= 0);
  	umask(omask);
  	if (ftmp >= 0) {
! 	    snprintf(line, 1024, "%u", seqnum);
  	    (void) lseek(fseqf, 0, SEEK_SET);
  	    if (Sys::write(fseqf, line, strlen(line)) != strlen(line) ||
  		ftruncate(fseqf,strlen(line)))
***************
*** 806,812 ****
      va_list ap;
      va_start(ap, fmt0);
      char fmt[256];
!     sprintf(fmt, "MODEM %s", fmt0);
      vtraceStatus(FAXTRACE_MODEMOPS, fmt, ap);
      va_end(ap);
  }
--- 806,812 ----
      va_list ap;
      va_start(ap, fmt0);
      char fmt[256];
!     snprintf(fmt, 256, "MODEM %s", fmt0);
      vtraceStatus(FAXTRACE_MODEMOPS, fmt, ap);
      va_end(ap);
  }
diff -cr ./faxd/ServerConfig.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/ServerConfig.c++
*** ./faxd/ServerConfig.c++	Sat Feb 14 05:49:36 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/ServerConfig.c++	Fri Jun  9 15:18:20 2000
***************
*** 373,381 ****
  {
      char fmt[128];
      if (module != NULL)
! 	sprintf(fmt, "%s: Warning, %s.", module, fmt0);
      else
! 	sprintf(fmt, "Warning, %s.", fmt0);
      vlogError(fmt, ap);
  }
  
--- 373,381 ----
  {
      char fmt[128];
      if (module != NULL)
! 	snprintf(fmt, 128, "%s: Warning, %s.", module, fmt0);
      else
! 	snprintf(fmt, 128, "Warning, %s.", fmt0);
      vlogError(fmt, ap);
  }
  
***************
*** 384,392 ****
  {
      char fmt[128];
      if (module != NULL)
! 	sprintf(fmt, "%s: Warning, %s.", module, fmt0);
      else
! 	sprintf(fmt, "Warning, %s.", fmt0);
      vlogWarning(fmt, ap);
  }
  
--- 384,392 ----
  {
      char fmt[128];
      if (module != NULL)
! 	snprintf(fmt, 128, "%s: Warning, %s.", module, fmt0);
      else
! 	snprintf(fmt, 128, "Warning, %s.", fmt0);
      vlogWarning(fmt, ap);
  }
  
diff -cr ./faxd/faxApp.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/faxApp.c++
*** ./faxd/faxApp.c++	Sat Feb 14 05:49:39 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/faxApp.c++	Fri Jun  9 15:17:18 2000
***************
*** 231,237 ****
  	    logError("fcntl: %m");
      }
      char msg[4096];
!     vsprintf(msg, fmt, ap);
      u_int len = strlen(msg)+1;
      if (Sys::write(faxqfifo, msg, len) != len) {
  	if (errno == EBADF || errno == EPIPE)		// reader expired
--- 231,237 ----
  	    logError("fcntl: %m");
      }
      char msg[4096];
!     vsnprintf(msg, 4096, fmt, ap);
      u_int len = strlen(msg)+1;
      if (Sys::write(faxqfifo, msg, len) != len) {
  	if (errno == EBADF || errno == EPIPE)		// reader expired
***************
*** 263,269 ****
  faxApp::sendModemStatus(const char* devid, const char* fmt0 ...)
  {
      char fmt[2*1024];
!     sprintf(fmt, "+%s:%s", devid, fmt0);
      va_list ap;
      va_start(ap, fmt0);
      fxBool ok = vsendQueuer(fmt, ap);
--- 263,269 ----
  faxApp::sendModemStatus(const char* devid, const char* fmt0 ...)
  {
      char fmt[2*1024];
!     snprintf(fmt, 2048, "+%s:%s", devid, fmt0);
      va_list ap;
      va_start(ap, fmt0);
      fxBool ok = vsendQueuer(fmt, ap);
***************
*** 278,284 ****
  faxApp::sendJobStatus(const char* jobid, const char* fmt0 ...)
  {
      char fmt[2*1024];
!     sprintf(fmt, "*%s:%s", jobid, fmt0);
      va_list ap;
      va_start(ap, fmt0);
      fxBool ok = vsendQueuer(fmt, ap);
--- 278,284 ----
  faxApp::sendJobStatus(const char* jobid, const char* fmt0 ...)
  {
      char fmt[2*1024];
!     snprintf(fmt, 2048, "*%s:%s", jobid, fmt0);
      va_list ap;
      va_start(ap, fmt0);
      fxBool ok = vsendQueuer(fmt, ap);
***************
*** 293,299 ****
  faxApp::sendRecvStatus(const char* devid, const char* fmt0 ...)
  {
      char fmt[2*1024];
!     sprintf(fmt, "@%s:%s", devid, fmt0);
      va_list ap;
      va_start(ap, fmt0);
      fxBool ok = vsendQueuer(fmt, ap);
--- 293,299 ----
  faxApp::sendRecvStatus(const char* devid, const char* fmt0 ...)
  {
      char fmt[2*1024];
!     snprintf(fmt, 2048, "@%s:%s", devid, fmt0);
      va_list ap;
      va_start(ap, fmt0);
      fxBool ok = vsendQueuer(fmt, ap);
diff -cr ./faxd/faxQueueApp.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/faxQueueApp.c++
*** ./faxd/faxQueueApp.c++	Sat Feb 14 05:49:42 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/faxQueueApp.c++	Fri Jun  9 15:13:31 2000
***************
*** 971,980 ****
  	 *   -m <maxpages>	max pages to generate
  	 *   -1|-2		1d or 2d encoding
  	 */
! 	char rbuf[20]; sprintf(rbuf, "%u", params.verticalRes());
! 	char wbuf[20]; sprintf(wbuf, "%u", params.pageWidth());
! 	char lbuf[20]; sprintf(lbuf, "%d", params.pageLength());
! 	char mbuf[20]; sprintf(mbuf, "%u", dci.getMaxSendPages());
  	const char* argv[30];
  	int ac = 0;
  	switch (req.op) {
--- 971,980 ----
  	 *   -m <maxpages>	max pages to generate
  	 *   -1|-2		1d or 2d encoding
  	 */
! 	char rbuf[20]; snprintf(rbuf, 20, "%u", params.verticalRes());
! 	char wbuf[20]; snprintf(wbuf, 20, "%u", params.pageWidth());
! 	char lbuf[20]; snprintf(lbuf, 20, "%d", params.pageLength());
! 	char mbuf[20]; snprintf(mbuf, 20, "%u", dci.getMaxSendPages());
  	const char* argv[30];
  	int ac = 0;
  	switch (req.op) {
***************
*** 2726,2734 ****
  {
      char fmt[128];
      if (module != NULL)
! 	sprintf(fmt, "%s: Warning, %s.", module, fmt0);
      else
! 	sprintf(fmt, "Warning, %s.", fmt0);
      vlogError(fmt, ap);
  }
  
--- 2726,2734 ----
  {
      char fmt[128];
      if (module != NULL)
! 	snprintf(fmt, 128, "%s: Warning, %s.", module, fmt0);
      else
! 	snprintf(fmt, 128, "Warning, %s.", fmt0);
      vlogError(fmt, ap);
  }
  
***************
*** 2737,2745 ****
  {
      char fmt[128];
      if (module != NULL)
! 	sprintf(fmt, "%s: Warning, %s.", module, fmt0);
      else
! 	sprintf(fmt, "Warning, %s.", fmt0);
      vlogWarning(fmt, ap);
  }
  
--- 2737,2745 ----
  {
      char fmt[128];
      if (module != NULL)
! 	snprintf(fmt, 128, "%s: Warning, %s.", module, fmt0);
      else
! 	snprintf(fmt, 128, "Warning, %s.", fmt0);
      vlogWarning(fmt, ap);
  }
  
diff -cr ./faxd/trigtest.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/trigtest.c++
*** ./faxd/trigtest.c++	Sat Feb 14 05:49:47 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/faxd/trigtest.c++	Fri Jun  9 15:20:07 2000
***************
*** 296,302 ****
      int fd, n;
      char msg[256];
  
!     sprintf(fifoName, "client/%u", getpid());
      if (Sys::mkfifo(fifoName, 0666) < 0 && errno != EEXIST) {
  	perror("mkfifo");
  	exit(-1);
--- 296,302 ----
      int fd, n;
      char msg[256];
  
!     snprintf(fifoName, 80, "client/%u", getpid());
      if (Sys::mkfifo(fifoName, 0666) < 0 && errno != EEXIST) {
  	perror("mkfifo");
  	exit(-1);
***************
*** 309,315 ****
  	unlink(fifoName);
  	exit(-1);
      }
!     sprintf(msg, "T%s:N%s", fifoName, trigger);
      send(msg, strlen(msg)+1);
      for (;;) {
  	FD_ZERO(&rd);
--- 309,315 ----
  	unlink(fifoName);
  	exit(-1);
      }
!     snprintf(msg, 256, "T%s:N%s", fifoName, trigger);
      send(msg, strlen(msg)+1);
      for (;;) {
  	FD_ZERO(&rd);
diff -cr ./hfaxd/HylaFAXServer.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd/HylaFAXServer.c++
*** ./hfaxd/HylaFAXServer.c++	Sat Feb 14 05:50:02 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd/HylaFAXServer.c++	Fri Jun  9 16:47:47 2000
***************
*** 161,169 ****
  {
      char fmt[128];
      if (module != NULL)
! 	sprintf(fmt, "%s: Warning, %s.", module, fmt0);
      else
! 	sprintf(fmt, "Warning, %s.", fmt0);
      vlogError(fmt, ap);
  }
  
--- 161,169 ----
  {
      char fmt[128];
      if (module != NULL)
! 	snprintf(fmt, 128, "%s: Warning, %s.", module, fmt0);
      else
! 	snprintf(fmt, 128, "Warning, %s.", fmt0);
      vlogError(fmt, ap);
  }
  
***************
*** 172,180 ****
  {
      char fmt[128];
      if (module != NULL)
! 	sprintf(fmt, "%s: Warning, %s.", module, fmt0);
      else
! 	sprintf(fmt, "Warning, %s.", fmt0);
      vlogWarning(fmt, ap);
  }
  
--- 172,180 ----
  {
      char fmt[128];
      if (module != NULL)
! 	snprintf(fmt, 128, "%s: Warning, %s.", module, fmt0);
      else
! 	snprintf(fmt, 128, "Warning, %s.", fmt0);
      vlogWarning(fmt, ap);
  }
  
***************
*** 530,536 ****
  	    filename, line);
  	seqnum = 1;
      }
!     sprintf(line, "%u", NEXTSEQNUM(seqnum+count));
      lseek(fd, 0, SEEK_SET);
      if (Sys::write(fd, line, strlen(line)) != strlen(line) ||
  		ftruncate(fd,strlen(line))) {
--- 530,536 ----
  	    filename, line);
  	seqnum = 1;
      }
!     snprintf(line, 1024, "%u", NEXTSEQNUM(seqnum+count));
      lseek(fd, 0, SEEK_SET);
      if (Sys::write(fd, line, strlen(line)) != strlen(line) ||
  		ftruncate(fd,strlen(line))) {
diff -cr ./hfaxd/Jobs.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd/Jobs.c++
*** ./hfaxd/Jobs.c++	Sat Feb 14 05:50:05 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd/Jobs.c++	Fri Jun  9 16:46:19 2000
***************
*** 1646,1652 ****
  		fprintf(fd, fspec, (const char*) job.company);
  		break;
  	    case 'D':
! 		sprintf(tmpbuf, "%2u:%-2u", job.totdials, job.maxdials);
  		fprintf(fd, fspec, tmpbuf);
  		break;
  	    case 'E':
--- 1646,1652 ----
  		fprintf(fd, fspec, (const char*) job.company);
  		break;
  	    case 'D':
! 		snprintf(tmpbuf, 20, "%2u:%-2u", job.totdials, job.maxdials);
  		fprintf(fd, fspec, tmpbuf);
  		break;
  	    case 'E':
***************
*** 1683,1689 ****
  		fprintf(fd, fspec, "N "[job.useccover]);
  		break;
  	    case 'P':
! 		sprintf(tmpbuf, "%2u:%-2u", job.npages, job.totpages);
  		fprintf(fd, fspec, tmpbuf);
  		break;
  	    case 'Q':
--- 1683,1689 ----
  		fprintf(fd, fspec, "N "[job.useccover]);
  		break;
  	    case 'P':
! 		snprintf(tmpbuf, 20, "%2u:%-2u", job.npages, job.totpages);
  		fprintf(fd, fspec, tmpbuf);
  		break;
  	    case 'Q':
***************
*** 1696,1706 ****
  		fprintf(fd, fspec, (const char*) job.sender);
  		break;
  	    case 'T':
! 		sprintf(tmpbuf, "%2u:%-2u", job.tottries, job.maxtries);
  		fprintf(fd, fspec, tmpbuf);
  		break;
  	    case 'U':
! 		sprintf(tmpbuf, "%.1f", job.chopthreshold);
  		fprintf(fd, fspec, tmpbuf);
  		break;
  	    case 'V':
--- 1696,1706 ----
  		fprintf(fd, fspec, (const char*) job.sender);
  		break;
  	    case 'T':
! 		snprintf(tmpbuf, 20, "%2u:%-2u", job.tottries, job.maxtries);
  		fprintf(fd, fspec, tmpbuf);
  		break;
  	    case 'U':
! 		snprintf(tmpbuf, 20, "%.1f", job.chopthreshold);
  		fprintf(fd, fspec, tmpbuf);
  		break;
  	    case 'V':
diff -cr ./hfaxd/OldProtocol.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd/OldProtocol.c++
*** ./hfaxd/OldProtocol.c++	Sat Feb 14 05:50:07 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd/OldProtocol.c++	Sat Jun 10 13:41:24 2000
***************
*** 352,359 ****
  OldProtocolServer::vsendClient(const char* tag, const char* fmt, va_list ap)
  {
      char buf[2048];
!     sprintf(buf, "%s:", tag);
!     vsprintf(strchr(buf,'\0'), fmt, ap);
      fprintf(stdout, "%s\n", buf);
      if (TRACE(PROTOCOL))
  	logDebug("%s", buf);
--- 352,359 ----
  OldProtocolServer::vsendClient(const char* tag, const char* fmt, va_list ap)
  {
      char buf[2048];
!     snprintf(buf, 2048, "%s:", tag);
!     vsnprintf(strchr(buf, '\0'), 2048-strlen(buf), fmt, ap);
      fprintf(stdout, "%s\n", buf);
      if (TRACE(PROTOCOL))
  	logDebug("%s", buf);
***************
*** 472,490 ****
      buf[0] = '\0';
      if (pwd->pw_gecos) {
  	if (pwd->pw_gecos[0] == '&') {
! 	    strcpy(buf, pwd->pw_name);
! 	    strcat(buf, pwd->pw_gecos+1);
  	    if (islower(buf[0]))
  		buf[0] = toupper(buf[0]);
  	} else
! 	    strcpy(buf, pwd->pw_gecos);
  	if ((cp = strchr(buf,',')) != 0)
  	    *cp = '\0';
  	/* see FaxClient::setupUserIdentity; strip SysV junk */
  	if ((cp = strchr(buf,'(')) != 0)
  	    *cp = '\0';
      } else
! 	strcpy(buf, pwd->pw_name);
      if (TRACE(PROTOCOL)) {
  	if (*buf)
  	     logDebug("%s user: \"%s\"", pwd->pw_name, buf);
--- 472,491 ----
      buf[0] = '\0';
      if (pwd->pw_gecos) {
  	if (pwd->pw_gecos[0] == '&') {
! 	    strncpy(buf, pwd->pw_name, sizeof(buf));
! 	    strncat(buf, pwd->pw_gecos+1, 
! 		sizeof(buf)-strlen(buf));
  	    if (islower(buf[0]))
  		buf[0] = toupper(buf[0]);
  	} else
! 	    strncpy(buf, pwd->pw_gecos, sizeof(buf));
  	if ((cp = strchr(buf,',')) != 0)
  	    *cp = '\0';
  	/* see FaxClient::setupUserIdentity; strip SysV junk */
  	if ((cp = strchr(buf,'(')) != 0)
  	    *cp = '\0';
      } else
! 	strncpy(buf, pwd->pw_name, sizeof(buf));
      if (TRACE(PROTOCOL)) {
  	if (*buf)
  	     logDebug("%s user: \"%s\"", pwd->pw_name, buf);
Only in /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd: OldProtocol.c++~
diff -cr ./hfaxd/Status.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd/Status.c++
*** ./hfaxd/Status.c++	Sat Feb 14 05:50:09 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd/Status.c++	Sat Jun 10 13:43:50 2000
***************
*** 260,275 ****
  		break;
  	    case 'r':
  		if (config.maxRecvPages == (u_int) -1)
! 		    strcpy(tmpbuf, "INF");
  		else
! 		    sprintf(tmpbuf, "%u", config.maxRecvPages);
  		fprintf(fd, fspec, config.maxRecvPages);
  		break;
  	    case 's':
  		fprintf(fd, fspec, (const char*) config.status);
  		break;
  	    case 't':
! 		sprintf(tmpbuf, "%05x:%05x",
  		    config.tracingLevel&0xfffff,
  		    config.logTracingLevel&0xfffff);
  		fprintf(fd, fspec, tmpbuf);
--- 260,275 ----
  		break;
  	    case 'r':
  		if (config.maxRecvPages == (u_int) -1)
! 		    strncpy(tmpbuf, "INF", sizeof(tmpbuf));
  		else
! 		    snprintf(tmpbuf, sizeof(tmpbuf), "%u", config.maxRecvPages);
  		fprintf(fd, fspec, config.maxRecvPages);
  		break;
  	    case 's':
  		fprintf(fd, fspec, (const char*) config.status);
  		break;
  	    case 't':
! 		snprintf(tmpbuf, sizeof(tmpbuf), "%05x:%05x",
  		    config.tracingLevel&0xfffff,
  		    config.logTracingLevel&0xfffff);
  		fprintf(fd, fspec, tmpbuf);
Only in /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd: Status.c++~
diff -cr ./hfaxd/UnixFaxServer.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd/UnixFaxServer.c++
*** ./hfaxd/UnixFaxServer.c++	Sat Feb 14 05:50:14 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/hfaxd/UnixFaxServer.c++	Fri Jun  9 17:01:32 2000
***************
*** 126,132 ****
      if (s >= 0) {
  	/* anchor socket to avoid multi-homing problems */
  	data_source.sun_family = AF_UNIX;
! 	strcpy(data_source.sun_path, ctrl_addr.sun_path);
  	if (bind(s, (struct sockaddr*) &data_source, sizeof (data_source)) >= 0) {
  	    return (fdopen(s, mode));
  	}
--- 126,132 ----
      if (s >= 0) {
  	/* anchor socket to avoid multi-homing problems */
  	data_source.sun_family = AF_UNIX;
! 	strncpy(data_source.sun_path, ctrl_addr.sun_path, sizeof(data_source.sun_path));
  	if (bind(s, (struct sockaddr*) &data_source, sizeof (data_source)) >= 0) {
  	    return (fdopen(s, mode));
  	}
Only in .: patch-aa
diff -cr ./port/syslog.c /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/port/syslog.c
*** ./port/syslog.c	Sat Feb 14 05:50:42 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/port/syslog.c	Fri Jun  9 23:26:03 2000
***************
*** 104,119 ****
  
  	/* build the message */
  	(void)time(&now);
! 	(void)sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4);
  	for (p = tbuf; *p; ++p);
  	if (LogStat & LOG_PERROR)
  		stdp = p;
  	if (LogTag) {
! 		(void)strcpy(p, LogTag);
  		for (; *p; ++p);
  	}
  	if (LogStat & LOG_PID) {
! 		(void)sprintf(p, "[%d]", getpid());
  		for (; *p; ++p);
  	}
  	if (LogTag) {
--- 104,122 ----
  
  	/* build the message */
  	(void)time(&now);
! 	(void)snprintf(tbuf, sizeof(tbuf)-4, "<%d>%.15s ", 
! 		pri, ctime(&now) + 4);
  	for (p = tbuf; *p; ++p);
  	if (LogStat & LOG_PERROR)
  		stdp = p;
  	if (LogTag) {
! 		(void)strncpy(p, LogTag, sizeof(tbuf)-(size_t)(p-tbuf)-4);
! 		tbuf[sizeof(tbuf)-1] = '\0';
  		for (; *p; ++p);
  	}
  	if (LogStat & LOG_PID) {
! 		(void)snprintf(p, 
! 			sizeof(tbuf)-(size_t)(p-tbuf)-4, "[%d]", getpid());
  		for (; *p; ++p);
  	}
  	if (LogTag) {
***************
*** 137,143 ****
  		*t1 = '\0';
  	}
  
! 	(void)vsprintf(p, fmt_cpy, ap);
  
  	cnt = strlen(tbuf);
  
--- 140,146 ----
  		*t1 = '\0';
  	}
  
! 	(void)vsnprintf(p, sizeof(tbuf)-(size_t)(p-tbuf)-2, fmt_cpy, ap);
  
  	cnt = strlen(tbuf);
  
diff -cr ./port/vsyslog.c /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/port/vsyslog.c
*** ./port/vsyslog.c	Sat Feb 14 05:50:42 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/port/vsyslog.c	Fri Jun  9 23:29:05 2000
***************
*** 49,54 ****
  		*cp++ = c;
  	    *cp = '\0';
  	}
! 	(void) vsprintf(tbuf, fmt_cpy, ap);
  	(void) syslog(pri, "%s", tbuf);
  }
--- 49,54 ----
  		*cp++ = c;
  	    *cp = '\0';
  	}
! 	(void) vsnprintf(tbuf, sizeof(tbuf), fmt_cpy, ap);
  	(void) syslog(pri, "%s", tbuf);
  }
diff -cr ./regex/engine.c /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/regex/engine.c
*** ./regex/engine.c	Sat Feb 14 05:48:19 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/regex/engine.c	Sat Jun 10 11:37:57 2000
***************
*** 1065,1073 ****
  	static char pbuf[10];
  
  	if (isprint(ch) || ch == ' ')
! 		sprintf(pbuf, "%c", ch);
  	else
! 		sprintf(pbuf, "\\%o", ch);
  	return(pbuf);
  }
  #endif
--- 1065,1073 ----
  	static char pbuf[10];
  
  	if (isprint(ch) || ch == ' ')
! 		snprintf(pbuf, 10, "%c", ch);
  	else
! 		snprintf(pbuf, 10, "\\%o", ch);
  	return(pbuf);
  }
  #endif
diff -cr ./regex/regerror.c /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/regex/regerror.c
*** ./regex/regerror.c	Sat Feb 14 05:48:21 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/regex/regerror.c	Sat Jun 10 11:36:28 2000
***************
*** 134,142 ****
  	
  		if (errcode&REG_ITOA) {
  			if (r->code != 0)
! 				(void) strcpy(convbuf, r->name);
  			else
! 				sprintf(convbuf, "REG_0x%x", target);
  			assert(strlen(convbuf) < sizeof(convbuf));
  			s = convbuf;
  		} else
--- 134,144 ----
  	
  		if (errcode&REG_ITOA) {
  			if (r->code != 0)
! 				(void) strncpy(convbuf, r->name, 
! 					sizeof(convbuf));
  			else
! 				snprintf(convbuf, sizeof(convbuf), 
! 					"REG_0x%x", target);
  			assert(strlen(convbuf) < sizeof(convbuf));
  			s = convbuf;
  		} else
diff -cr ./sgi2fax/imgtofax.c /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/sgi2fax/imgtofax.c
*** ./sgi2fax/imgtofax.c	Sat Feb 14 05:50:22 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/sgi2fax/imgtofax.c	Fri Jun  9 23:35:05 2000
***************
*** 214,220 ****
      TIFFSetField(tif, TIFFTAG_PAGENUMBER, pn, npages);
      TIFFSetField(tif, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
      { char buf[1024];
!       sprintf(buf, "Ditherered B&W version of %s", input);
        TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, buf);
      }
      TIFFSetField(tif, TIFFTAG_SOFTWARE, "sgi2fax");
--- 214,220 ----
      TIFFSetField(tif, TIFFTAG_PAGENUMBER, pn, npages);
      TIFFSetField(tif, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
      { char buf[1024];
!       snprintf(buf, 1024, "Ditherered B&W version of %s", input);
        TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, buf);
      }
      TIFFSetField(tif, TIFFTAG_SOFTWARE, "sgi2fax");
diff -cr ./util/FaxClient.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/FaxClient.c++
*** ./util/FaxClient.c++	Sat Feb 14 05:47:16 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/FaxClient.c++	Fri Jun  9 23:47:23 2000
***************
*** 622,628 ****
  	    traceServer("-> ADMIN XXXX");
  	else {
  	    char buf[128];
! 	    sprintf(buf, "-> %s", fmt);
  	    vtraceServer(buf, ap);
  	}
      }
--- 622,628 ----
  	    traceServer("-> ADMIN XXXX");
  	else {
  	    char buf[128];
! 	    snprintf(buf, 128, "-> %s", fmt);
  	    vtraceServer(buf, ap);
  	}
      }
diff -cr ./util/PageSize.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/PageSize.c++
*** ./util/PageSize.c++	Sat Feb 14 05:47:21 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/PageSize.c++	Fri Jun  9 23:57:44 2000
***************
*** 72,78 ****
  PageSizeInfo::readPageInfoFile()
  {
      char file[1024];
!     sprintf(file, "%s/%s", FAX_LIBDATA, FAX_PAGESIZES);
      PageInfoArray* info = new PageInfoArray;
      FILE* fp = fopen(file, "r");
      u_int lineno = 0;
--- 72,78 ----
  PageSizeInfo::readPageInfoFile()
  {
      char file[1024];
!     snprintf(file, sizeof(file), "%s/%s", FAX_LIBDATA, FAX_PAGESIZES);
      PageInfoArray* info = new PageInfoArray;
      FILE* fp = fopen(file, "r");
      u_int lineno = 0;
diff -cr ./util/SNPPClient.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/SNPPClient.c++
*** ./util/SNPPClient.c++	Sat Feb 14 05:47:25 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/SNPPClient.c++	Fri Jun  9 23:57:07 2000
***************
*** 638,644 ****
  	    traceServer("-> LOGI XXXX");
  	else {
  	    char buf[128];
! 	    sprintf(buf, "-> %s", fmt);
  	    vtraceServer(buf, ap);
  	}
      }
--- 638,644 ----
  	    traceServer("-> LOGI XXXX");
  	else {
  	    char buf[128];
! 	    snprintf(buf, sizeof(buf), "-> %s", fmt);
  	    vtraceServer(buf, ap);
  	}
      }
diff -cr ./util/StackBuffer.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/StackBuffer.c++
*** ./util/StackBuffer.c++	Sat Feb 14 05:47:26 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/StackBuffer.c++	Fri Jun  9 23:55:42 2000
***************
*** 105,111 ****
  fxStackBuffer::vput(const char* fmt, va_list ap)
  {
      char buf[8*1024];
!     vsprintf(buf, fmt, ap);
      put(buf);
  }
  
--- 105,111 ----
  fxStackBuffer::vput(const char* fmt, va_list ap)
  {
      char buf[8*1024];
!     vsnprintf(buf, sizeof(buf), fmt, ap);
      put(buf);
  }
  
diff -cr ./util/Str.c++ /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/Str.c++
*** ./util/Str.c++	Sat Feb 14 05:47:27 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/Str.c++	Fri Jun  9 15:36:38 2000
***************
*** 91,97 ****
  {
      char buffer[NUMBUFSIZE];
      if (!format) format = "%d";
!     sprintf(buffer,format,a);
      slength = strlen(buffer) + 1;
      data = (char*) malloc(slength);
      memcpy(data,buffer,slength);
--- 91,97 ----
  {
      char buffer[NUMBUFSIZE];
      if (!format) format = "%d";
!     snprintf(buffer, NUMBUFSIZE, format,a);
      slength = strlen(buffer) + 1;
      data = (char*) malloc(slength);
      memcpy(data,buffer,slength);
***************
*** 101,107 ****
  {
      char buffer[NUMBUFSIZE];
      if (!format) format = "%ld";
!     sprintf(buffer,format,a);
      slength = strlen(buffer) + 1;
      data = (char*) malloc(slength);
      memcpy(data,buffer,slength);
--- 101,107 ----
  {
      char buffer[NUMBUFSIZE];
      if (!format) format = "%ld";
!     snprintf(buffer, NUMBUFSIZE, format,a);
      slength = strlen(buffer) + 1;
      data = (char*) malloc(slength);
      memcpy(data,buffer,slength);
***************
*** 111,117 ****
  {
      char buffer[NUMBUFSIZE];
      if (!format) format = "%g";
!     sprintf(buffer,format,a);
      slength = strlen(buffer) + 1;
      fxAssert(slength>1, "Str::Str(float): bogus conversion");
      data = (char*) malloc(slength);
--- 111,117 ----
  {
      char buffer[NUMBUFSIZE];
      if (!format) format = "%g";
!     snprintf(buffer, NUMBUFSIZE, format,a);
      slength = strlen(buffer) + 1;
      fxAssert(slength>1, "Str::Str(float): bogus conversion");
      data = (char*) malloc(slength);
***************
*** 122,128 ****
  {
      char buffer[NUMBUFSIZE];
      if (!format) format = "%lg";
!     sprintf(buffer,format,a);
      slength = strlen(buffer) + 1;
      fxAssert(slength>1, "Str::Str(double): bogus conversion");
      data = (char*) malloc(slength); // XXX assume slength>1
--- 122,128 ----
  {
      char buffer[NUMBUFSIZE];
      if (!format) format = "%lg";
!     snprintf(buffer, NUMBUFSIZE, format,a);
      slength = strlen(buffer) + 1;
      fxAssert(slength>1, "Str::Str(double): bogus conversion");
      data = (char*) malloc(slength); // XXX assume slength>1
***************
*** 141,147 ****
      char buf[4096];
      va_list ap;
      va_start(ap, fmt);
!     vsprintf(buf, fmt, ap);
      va_end(ap);
      return fxStr(buf);
  }
--- 141,147 ----
      char buf[4096];
      va_list ap;
      va_start(ap, fmt);
!     vsnprintf(buf, 4096, fmt, ap);
      va_end(ap);
      return fxStr(buf);
  }
***************
*** 150,156 ****
  fxStr::vformat(const char* fmt, va_list ap)
  {
      char buf[4096];
!     vsprintf(buf, fmt, ap);
      return fxStr(buf);
  }
  
--- 150,156 ----
  fxStr::vformat(const char* fmt, va_list ap)
  {
      char buf[4096];
!     vsnprintf(buf, 4096, fmt, ap);
      return fxStr(buf);
  }
  
diff -cr ./util/faxconfig.c /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/faxconfig.c
*** ./util/faxconfig.c	Sat Feb 14 05:47:57 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/faxconfig.c	Fri Jun  9 23:49:19 2000
***************
*** 81,92 ****
  	}
      if (devid != NULL) {
  	if (devid[0] == FAX_FIFO[0])
! 	    strcpy(fifoname, devid);
  	else
! 	    sprintf(fifoname, "%s.%.*s", FAX_FIFO,
  		sizeof (fifoname) - sizeof (FAX_FIFO), devid);
      } else
! 	strcpy(fifoname, FAX_FIFO);
      for (cp = fifoname; cp = strchr(cp, '/'); *cp++ = '_')
  	;
      if (chdir(spooldir) < 0)
--- 81,92 ----
  	}
      if (devid != NULL) {
  	if (devid[0] == FAX_FIFO[0])
! 	    strncpy(fifoname, devid, sizeof(fifoname));
  	else
! 	    snprintf(fifoname, sizeof(fifoname), "%s.%.*s", FAX_FIFO,
  		sizeof (fifoname) - sizeof (FAX_FIFO), devid);
      } else
! 	strncpy(fifoname, FAX_FIFO, sizeof(fifoname));
      for (cp = fifoname; cp = strchr(cp, '/'); *cp++ = '_')
  	;
      if (chdir(spooldir) < 0)
***************
*** 111,120 ****
  		quote = 1;
  	    cmd = malloc(strlen(argv[optind])+strlen(argv[optind+1])+10);
  	    if (quote)
! 		sprintf(cmd, "C%s%s:\"%s\"",
  		    isQueuer ? ":" : "", argv[optind], argv[optind+1]);
  	    else
! 		sprintf(cmd, "C%s%s:%s",
  		    isQueuer ? ":" : "", argv[optind], argv[optind+1]);
  	    if (write(fifo, cmd, strlen(cmd)) != strlen(cmd))
  		fatal("%s: FIFO write failed for command (%s)",
--- 111,120 ----
  		quote = 1;
  	    cmd = malloc(strlen(argv[optind])+strlen(argv[optind+1])+10);
  	    if (quote)
! 		snprintf(cmd, sizeof(cmd), "C%s%s:\"%s\"",
  		    isQueuer ? ":" : "", argv[optind], argv[optind+1]);
  	    else
! 		snprintf(cmd, sizeof(cmd), "C%s%s:%s",
  		    isQueuer ? ":" : "", argv[optind], argv[optind+1]);
  	    if (write(fifo, cmd, strlen(cmd)) != strlen(cmd))
  		fatal("%s: FIFO write failed for command (%s)",
diff -cr ./util/faxmodem.c /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/faxmodem.c
*** ./util/faxmodem.c	Sat Feb 14 05:47:57 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/faxmodem.c	Fri Jun  9 23:50:28 2000
***************
*** 243,251 ****
      if (optind != argc-1)
  	fatal("Missing modem device.\nusage: %s %s modem", argv[0], usage);
      if (strncmp(argv[optind], _PATH_DEV, strlen(_PATH_DEV)) == 0)
! 	strcpy(devname, argv[optind]+strlen(_PATH_DEV));
      else
! 	strcpy(devname, argv[optind]);
      for (cp = devname; cp = strchr(cp, '/'); *cp++ = '_')
  	;
      if (chdir(spooldir) < 0)
--- 243,251 ----
      if (optind != argc-1)
  	fatal("Missing modem device.\nusage: %s %s modem", argv[0], usage);
      if (strncmp(argv[optind], _PATH_DEV, strlen(_PATH_DEV)) == 0)
! 	strncpy(devname, argv[optind]+strlen(_PATH_DEV), sizeof(devname));
      else
! 	strncpy(devname, argv[optind], sizeof(devname));
      for (cp = devname; cp = strchr(cp, '/'); *cp++ = '_')
  	;
      if (chdir(spooldir) < 0)
***************
*** 254,262 ****
      if (fifo < 0)
  	fatal("%s: open: %s", FAX_FIFO, strerror(errno));
      if (priority != -1)
! 	sprintf(cmd, "+%s:R%c%08x:%x", devname, canpoll, caps, priority);
      else
! 	sprintf(cmd, "+%s:R%c%08x", devname, canpoll, caps);
      if (write(fifo, cmd, strlen(cmd)) != strlen(cmd))
  	fatal("%s: FIFO write failed for command (%s)",
  	    argv[0], strerror(errno));
--- 254,263 ----
      if (fifo < 0)
  	fatal("%s: open: %s", FAX_FIFO, strerror(errno));
      if (priority != -1)
! 	snprintf(cmd, sizeof(cmd), "+%s:R%c%08x:%x", devname, canpoll, 
! 		caps, priority);
      else
! 	snprintf(cmd, sizeof(cmd), "+%s:R%c%08x", devname, canpoll, caps);
      if (write(fifo, cmd, strlen(cmd)) != strlen(cmd))
  	fatal("%s: FIFO write failed for command (%s)",
  	    argv[0], strerror(errno));
diff -cr ./util/faxmsg.c /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/faxmsg.c
*** ./util/faxmsg.c	Sat Feb 14 05:47:58 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/faxmsg.c	Fri Jun  9 23:51:29 2000
***************
*** 108,119 ****
  	}
      if (optind == argc-1) {
  	if (argv[optind][0] == FAX_FIFO[0])
! 	    strcpy(fifoname, argv[optind]);
  	else
! 	    sprintf(fifoname, "%s.%.*s", FAX_FIFO,
  		sizeof (fifoname) - sizeof (FAX_FIFO), argv[optind]);
      } else if (!modemRequired) {
! 	strcpy(fifoname, FAX_FIFO);
      } else
  	fatal("usage: %s %s", argv[0], usage);
      for (cp = fifoname; cp = strchr(cp, '/'); *cp++ = '_')
--- 108,119 ----
  	}
      if (optind == argc-1) {
  	if (argv[optind][0] == FAX_FIFO[0])
! 	    strncpy(fifoname, argv[optind], sizeof(fifoname));
  	else
! 	    snprintf(fifoname, sizeof(fifoname), "%s.%.*s", FAX_FIFO,
  		sizeof (fifoname) - sizeof (FAX_FIFO), argv[optind]);
      } else if (!modemRequired) {
! 	strncpy(fifoname, FAX_FIFO, sizeof(fifoname));
      } else
  	fatal("usage: %s %s", argv[0], usage);
      for (cp = fifoname; cp = strchr(cp, '/'); *cp++ = '_')
***************
*** 123,129 ****
      fifo = open(fifoname, O_WRONLY|O_NDELAY);
      if (fifo < 0)
  	fatal("%s: open: %s", fifoname, strerror(errno));
!     sprintf(cmd, cmdfmt, arg);
      if (write(fifo, cmd, strlen(cmd)) != strlen(cmd))
  	fatal("FIFO write failed for command (%s)", strerror(errno));
      (void) close(fifo);
--- 123,129 ----
      fifo = open(fifoname, O_WRONLY|O_NDELAY);
      if (fifo < 0)
  	fatal("%s: open: %s", fifoname, strerror(errno));
!     snprintf(cmd, sizeof(cmd), cmdfmt, arg);
      if (write(fifo, cmd, strlen(cmd)) != strlen(cmd))
  	fatal("FIFO write failed for command (%s)", strerror(errno));
      (void) close(fifo);
diff -cr ./util/faxstate.c /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/faxstate.c
*** ./util/faxstate.c	Sat Feb 14 05:47:58 1998
--- /usr/ports/comms/hylafax_new/hylafax-v4.0pl2/util/faxstate.c	Fri Jun  9 23:38:55 2000
***************
*** 113,119 ****
  	}
      if (optind != argc-1)
  	fatal("Bad option `%c'; usage: %s %s modem", c, argv[0], usage);
!     strcpy(devid, argv[optind]);
      for (cp = devid; cp = strchr(cp, '/'); *cp++ = '_')
  	;
      if (chdir(spooldir) < 0)
--- 113,119 ----
  	}
      if (optind != argc-1)
  	fatal("Bad option `%c'; usage: %s %s modem", c, argv[0], usage);
!     strncpy(devid, argv[optind], sizeof(devid));
      for (cp = devid; cp = strchr(cp, '/'); *cp++ = '_')
  	;
      if (chdir(spooldir) < 0)
***************
*** 126,141 ****
  	fifo = open(FAX_FIFO, O_WRONLY|O_NDELAY);
  	if (fifo < 0)
  	    fatal("%s: open: %s", FAX_FIFO, strerror(errno));
! 	sprintf(cmd, "+%s:%s", devid, arg);
  	if (write(fifo, cmd, strlen(cmd)) != strlen(cmd))
  	    fatal("FIFO write failed for command (%s)", strerror(errno));
      } else {
! 	sprintf(fifoname, "%s.%.*s", FAX_FIFO,
  	    sizeof (fifoname) - sizeof (FAX_FIFO), devid);
  	fifo = open(fifoname, O_WRONLY|O_NDELAY);
  	if (fifo < 0) 
  	    fatal("%s: open: %s", fifoname, strerror(errno));
! 	sprintf(cmd, "S%s", arg);
  	if (write(fifo, cmd, strlen(cmd)) != strlen(cmd))
  	    fatal("FIFO write failed for command (%s)", strerror(errno));
      }
--- 126,141 ----
  	fifo = open(FAX_FIFO, O_WRONLY|O_NDELAY);
  	if (fifo < 0)
  	    fatal("%s: open: %s", FAX_FIFO, strerror(errno));
! 	snprintf(cmd, sizeof(cmd), "+%s:%s", devid, arg);
  	if (write(fifo, cmd, strlen(cmd)) != strlen(cmd))
  	    fatal("FIFO write failed for command (%s)", strerror(errno));
      } else {
! 	snprintf(fifoname, sizeof(cmd), "%s.%.*s", FAX_FIFO,
  	    sizeof (fifoname) - sizeof (FAX_FIFO), devid);
  	fifo = open(fifoname, O_WRONLY|O_NDELAY);
  	if (fifo < 0) 
  	    fatal("%s: open: %s", fifoname, strerror(errno));
! 	snprintf(cmd, sizeof(cmd), "S%s", arg);
  	if (write(fifo, cmd, strlen(cmd)) != strlen(cmd))
  	    fatal("FIFO write failed for command (%s)", strerror(errno));
      }


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000610201148.9025137B586>