*BSD News Article 14685


Return to BSD News archive

Xref: sserve comp.mail.sendmail:7348 comp.os.386bsd.bugs:521
Path: sserve!newshost.anu.edu.au!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!werple.apana.org.au!news
From: andrew@werple.apana.org.au (Andrew Herbert)
Newsgroups: comp.mail.sendmail,comp.os.386bsd.bugs
Subject: arpatounix() fix for sendmail 5.67a/IDA-1.5
Date: 20 Apr 1993 16:21:34 +1000
Organization: werple public-access unix, Melbourne
Lines: 58
Message-ID: <1r04pe$7bg@werple.apana.org.au>
NNTP-Posting-Host: werple.apana.org.au

Recently my sendmail was having a really hard time with a message arriving
with a date field "Date: Wed, 14 Apr 1993 16:36:25 +119304028 (CDT)".  The
huge timezone offset was resulting in a corrupted state structure in the
ctime(3) library routines (presumably from the call to asctime() made at the
end of arpatounix()).  This resulted in a later syslog() call killing
sendmail with a SIGSEGV.

The OS in question: 386bsd - a BSD NetRel2 derivative.  I guess if I was
really keen I would track down the problem in the ctime routines.  For now,
however, here's a patch for sendmail.

enjoy,
Andrew
--
*** arpadate.c.orig	Mon Apr 19 21:38:42 1993
--- arpadate.c	Tue Apr 20 15:57:36 1993
***************
*** 404,411 ****
  		int off;
  
  		off = atoi(++p);
! 		h_offset = off / 100;
! 		m_offset = off % 100;
  	}
  	else if (*p == '-')
  	{
--- 404,413 ----
  		int off;
  
  		off = atoi(++p);
! 		if (off > -2400 && off < 2400) {
! 			h_offset = off / 100;
! 			m_offset = off % 100;
! 		}
  	}
  	else if (*p == '-')
  	{
***************
*** 412,419 ****
  		int off;
  
  		off = atoi(++p);
! 		h_offset = off / -100;
! 		m_offset = -1 * (off % 100);
  	}
  	else
  	{
--- 414,423 ----
  		int off;
  
  		off = atoi(++p);
! 		if (off > -2400 && off < 2400) {
! 			h_offset = off / -100;
! 			m_offset = -1 * (off % 100);
! 		}
  	}
  	else
  	{