bug in syslog(8)

Satz%sri-tsc at sri-unix.UUCP Satz%sri-tsc at sri-unix.UUCP
Mon Mar 12 12:24:00 AEST 1984


From:  Greg Satz <Satz at sri-tsc>


Depending on the log message level, syslog(8) might try to wall a
message to the list of users in /etc/syslog.conf or to all of the
logged in users.  Each forked process winds up hanging instead of
sending the message.  The gethostname() call has the second argument
passed as an address instead of by value.

Because of some large mailing lists, syslog dumped core unless MAXLINE
was increased.

My version of syslog has some fixes that allow it to run under 2.9
(4.1a).  Drop me a note if you are interested.

*** /tmp/,RCSt1013071	Sun Mar 11 17:57:59 1984
--- syslog.c	Fri Feb 24 10:36:59 1984
***************
*** 30,36
  
  # define	NLOGS		10	/* max number of log files */
  # define	NSUSERS		10	/* max number of special users */
! # define	MAXLINE		256	/* maximum line length */
  
  # define	LOGHOSTNAME	1	/* log hostid on each line */
  

--- 30,36 -----
  
  # define	NLOGS		10	/* max number of log files */
  # define	NSUSERS		10	/* max number of special users */
! # define	MAXLINE		1024	/* maximum line length */
  
  # define	LOGHOSTNAME	1	/* log hostid on each line */
***************
*** 958,964
  #ifdef LOG_IPC
  	extern char *gethostname();
  	char hbuf[32];
- 	auto int hlen;
  #endif LOG_IPC
  
  	/* open the user login file */

--- 969,974 -----
  #ifdef LOG_IPC
  	extern char *gethostname();
  	char hbuf[32];
  #endif LOG_IPC
  
  	/* open the user login file */
***************
*** 1021,1028
  		strcpy(sbuf, "\r\n\007Broadcast message from ");
  #ifdef LOG_IPC
  		strcat(sbuf, "syslog@");
! 		hlen = sizeof hbuf;
! 		gethostname(hbuf, &hlen);
  		strcat(sbuf, hbuf);
  #else LOG_IPC
  		strcat(sbuf, sysname);

--- 1036,1042 -----
  		strcpy(sbuf, "\r\n\007Broadcast message from ");
  #ifdef LOG_IPC
  		strcat(sbuf, "syslog@");
! 		gethostname(hbuf, sizeof hbuf);
  		strcat(sbuf, hbuf);
  #else LOG_IPC
  		strcat(sbuf, sysname);



More information about the Comp.unix.wizards mailing list