On BNET: Apple's insanely great marketing
BNET Business Network:
BNET
TechRepublic
ZDNet
TalkBack 9 of 33:
Next »
« Previous
lint and char[256]
you know the old function calls

char *inputstring=(char *)malloc(2048);
scanf(INPUTSTREAM,"%s",inputstring);

how many times have you used the same kind of
code as the above. Note by default, you can
overrun program memory by there being a string on
INPUTSTREAM larger than 2048. If you hit the
stack, you can put a return address in there, put
code in the overflow, and next time a subroutine
finishes, you've got control.

When you write quick n dirty code, you do the
above. Later it gets missed. This is why memory
control isn't any good in the hands of most
programmers.

Memory leaks can be tested for by lint and so on,
but if you have a process running for a while,
how do you distinguish from heap that's being
allocated and heap that's been "lost".

I think there is some GNU stdlib which tracks
lost malloc'd memory and when a pointer which is
the last reference to a block is assigned to a
new value, the pointer assignment barfs. I think
the pointers probably have reference counters
built in, and are smart in some way.

Still, write it in java, and you know you havent
got the same problem! (note you can compile java
with gcj, which is just another face of gnuC).
Posted by: hipparchus2001   Posted on: 02/04/05 You are currently: a Guest | Members login | Terms of Use

Alert moderator to an offensive message

Subscribe to this discussion via Email or RSS

how many of these did they fix?  reid.thompson@... | 02/04/05
Was something broken?  The King's Servant | 02/04/05
Was something broken? YES  reid.thompson@... | 02/07/05
Hmmm  Linux User 147560 | 02/04/05
100% honest question  NonZealot | 02/04/05
Fewer Bugs Versus Simpler Application  jasonp@... | 02/04/05
Assumes a linear progression of bugs  NonZealot | 02/04/05
What about the severity of the bugs?  Hugh Jass | 02/04/05
lint and char[256]  hipparchus2001 | 02/04/05
Don't forget  seosamh_z | 02/06/05
Um, never....  Jomo_z | 02/07/05
Would this mean...  Mack DaNife | 02/07/05
Well..  d_jedi | 02/04/05
Stored procecures aren't used often  voska | 02/05/05
My experience differs  NonZealot | 02/05/05
Not with "in house" projects  toadlife | 02/05/05
Spoken like a true technotard  Chad_z | 02/04/05
Chad, your noise is missing the point  DePiep | 02/05/05
Chad the Great  seosamh_z | 02/06/05
MySQL is a companies product  B.O.F.H. | 02/06/05
RE: 100% honest question  richdave | 02/05/05
This isnt a troll...  vdraken | 02/04/05
The comparison is...  The King's Servant | 02/04/05
I was so concerned.....  michael-t | 02/04/05
Few bugs.. I don't think so!  d_jedi | 02/04/05
and your point is? nt  michael-t | 02/04/05
Isn't Coverity typical commercial code?  gsbtech | 02/04/05
Linux ratio is 1/17,000, not 10,000  DePiep | 02/05/05
Courage.  richdave | 02/05/05
YA GOTTA BE KIDDING ME!!  Xunil_Sierutuf | 02/05/05
Finally!  Outside T. Box | 02/07/05
Another cheap marketing gimmick  tpepernic | 02/05/05
"Commercial Code"?  Rodney Davis | 02/07/05

What do you think?

SponsoredWhite Papers, Webcasts, and Downloads

advertisement
advertisement

SmartPlanet

Click Here