🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #123

Re: I am stumped on this one!!!

#123
From: Brad Bobak
Date: Sat, 25 Jul 1992 18:52
31 lines
1292 bytes
In article <1992Jul25.165451.21726@infoac.rmi.de>, siebeck@infoac.rmi.de (Wolfgang Siebeck ) writes:
> 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);

 Ooops, a little slip there ;)

> 
> 
> >>		strcpy(cp_line, "\0");
> >>		tmp_line = cp_line;
> 
> -ws
> --
> siebeck@infoac.rmi.de (Wolfgang Siebeck)
> 
Technical Details
Message-ID: <BryKEp.48y@undergrad.math.waterloo.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!watserv1!watmath!undergrad.math.waterloo.edu!bbobak
References: <1992Jul24.204944.18516@cbfsb.cb.att.com> <1992Jul25.165451.21726@infoac.rmi.de>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!watserv1!watmath!undergrad.math.waterloo.edu!bbobak
From: bbobak@undergrad.math.waterloo.edu (Brad Bobak)
Subject: Re: I am stumped on this one!!!
Message-ID: <BryKEp.48y@undergrad.math.waterloo.edu>
Organization: University of Waterloo
References: <1992Jul24.204944.18516@cbfsb.cb.att.com> <1992Jul25.165451.21726@infoac.rmi.de>
Date: Sat, 25 Jul 1992 18:52:00 GMT
Lines: 33