[alt.sources.d] Blank trimmer

jordan@Morgan.COM (Jordan Hayes) (08/30/89)

Tom Neff <tneff@bfmny0.UU.NET> writes:

	This is one of those nasty hacks purists get on your case for
	because you can do it all with sed(1).  However I have a
	specialized application where I use real long lines ...

>Xmain()
>X{
>X	char s[65536];		/*  whatever  */
>X
>X	while (gets(s) != NULL)

No, this is one of those nasty hacks purists get on your case about
because you use gets() instead of fgets() ...

/jordan

cosell@bbn.com (Bernie Cosell) (08/31/89)

In article <358@s1.Morgan.COM> jordan@Morgan.COM (Jordan Hayes) writes:
}Tom Neff <tneff@bfmny0.UU.NET> writes:
}
}>Xmain()
}>X{
}>X	char s[65536];		/*  whatever  */
}>X
}>X	while (gets(s) != NULL)
}
}No, this is one of those nasty hacks purists get on your case about
}because you use gets() instead of fgets() ...

Lest you mention 'purist' as if it was some kind of a dirty word, you
should look at one of the reports on the internet virus.  One of the
ways it used to penetrate systems was to take advantage of a "gets"
that should have been an 'fgets', and by sending a VERY long password
overwrote the stack, and by putting the right magic stuff on the stack
it arranged things so that it was given access as the now-bogus stack
unwound.

   __
  /  )                              Bernie Cosell
 /--<  _  __  __   o _              BBN Sys & Tech, Cambridge, MA 02238
/___/_(<_/ (_/) )_(_(<_             cosell@bbn.com

allbery@NCoast.ORG (Brandon S. Allbery) (09/02/89)

As quoted from <358@s1.Morgan.COM> by jordan@Morgan.COM (Jordan Hayes):
+---------------
| Tom Neff <tneff@bfmny0.UU.NET> writes:
| 	This is one of those nasty hacks purists get on your case for
| 	because you can do it all with sed(1).  However I have a
| 
| >X	while (gets(s) != NULL)
| 
| No, this is one of those nasty hacks purists get on your case about
| because you use gets() instead of fgets() ...
+---------------

One of those nasty hacks that RTM just *loves*....

++Brandon
-- 
Brandon S. Allbery, moderator of comp.sources.misc	     allbery@NCoast.ORG
uunet!hal.cwru.edu!ncoast!allbery		    ncoast!allbery@hal.cwru.edu
"Why do trans-atlantic transfers take so long?"
"Electrons don't swim very fast."  -john@minster.york.ac.uk and whh@PacBell.COM