🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #122

Re: I am stumped on this one!!!

#122
From: Wolfgang Siebeck
Date: Sat, 25 Jul 1992 16:54
26 lines
1162 bytes
bbobak@undergrad.math.waterloo.edu (Brad Bobak) writes:

>In article <1992Jul24.204944.18516@cbfsb.cb.att.com> rajeev@cbnewsf.cb.att.com (rajeev.dolas) writes:
>>
>>Hello all,
>>
>>		pbuf = pars_wbuf;
>>		cp_line = (char *)malloc(sizeof(strlen(pars_wbuf)));


> You're allocing the sizeof an int, which is likely four bytes.
> You also forgot to alloc space for the '\0'. Try it again with:

>	cp_line = (char*)malloc(sizeof(strlen(pars_wbuf) + 1));

or better:

	cp_line = (char*)malloc(strlen(pars_wbuf) + 1);


>>		strcpy(cp_line, "\0");
>>		tmp_line = cp_line;

-ws
--
siebeck@infoac.rmi.de (Wolfgang Siebeck)
Technical Details
Message-ID: <1992Jul25.165451.21726@infoac.rmi.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!infoac!siebeck
References: <1992Jul24.204944.18516@cbfsb.cb.att.com> <Brx394.4qL@undergrad.math.waterloo.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!infoac!siebeck
From: siebeck@infoac.rmi.de (Wolfgang Siebeck )
Subject: Re: I am stumped on this one!!!
Message-ID: <1992Jul25.165451.21726@infoac.rmi.de>
Organization: RMI Net INFO.box Systems * Aachen * Hamburg * Flensburg
References: <1992Jul24.204944.18516@cbfsb.cb.att.com> <Brx394.4qL@undergrad.math.waterloo.edu>
Date: Sat, 25 Jul 1992 16:54:51 GMT
Lines: 27