Article View: comp.sources.d
Article #1751Re: tgif core dumps all the time -- just mine?
From: Andrew H. Marrinson
Date: Mon, 15 Apr 1991 20:58
Date: Mon, 15 Apr 1991 20:58
39 lines
1642 bytes
1642 bytes
No, it isn't just you. I had to make the following change to msg.c
(in addition to a handful of other stuff for System V that you
presumably found already):
*** msg.c~ Thu Mar 21 15:46:00 1991
--- msg.c Thu Mar 21 16:57:32 1991
***************
*** 38,44 ****
if (*Msg == '\0') { topMsgNumber = msgCount; return; }
! s = (char *) calloc (strlen (Msg), sizeof(char));
msg_ptr = (struct MsgRec *) calloc (1, sizeof(struct MsgRec));
strcpy (s, Msg);
--- 38,44 ----
if (*Msg == '\0') { topMsgNumber = msgCount; return; }
! s = (char *) calloc (strlen (Msg) + 1, sizeof(char));
msg_ptr = (struct MsgRec *) calloc (1, sizeof(struct MsgRec));
strcpy (s, Msg);
-------------- END OF PATCH -------------
It seems as though some mallocs always allocate a little bit more
memory than you ask for. I found a virtually identical bug in the CMU
SNMP client. The System V malloc is not so forgiving!
I haven't sent this bug fix to the author of tgif yet. I suppose I
ought to...
Hope this helps...
--
Andrew H. Marrinson
Icom Systems, Inc.
Wheeling, IL, USA
(andy@icom.icom.com)
Technical Details
Message-ID:
<andy.671749133@xwkg>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!crdgw1!uunet!icom!xwkg.Icom.Com!andyReferences:
<150@mx-1>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!crdgw1!uunet!icom!xwkg.Icom.Com!andy From: andy@xwkg.Icom.Com (Andrew H. Marrinson) Newsgroups: comp.sources.d Subject: Re: tgif core dumps all the time -- just mine? Keywords: tgif bugs Message-ID: <andy.671749133@xwkg> Date: 15 Apr 91 20:58:53 GMT References: <150@mx-1> Sender: news@icom.icom.com (News Feed) Organization: Icom Systems, Inc. Lines: 39