PLEX86  x86- Virtual Machine (VM) Program
 Plex86  |  CVS  |  Mailing List  |  Download  |  Computer Folklore

Lit. Buffer overruns 1718


I'm afraid that's false. The Windows piping and redirection mechanisms do not treat byte value 26 (ASCII SUB) in any special fashion. The Microsoft C implementation of stdio does, when operating on text-mode streams, which may be an equivalent problem, for your purposes. But it's not the piping or redirection mechanism that's at fault; it's the C implementation.

It's trivial to demonstrate this with a program that doesn't use the MS C runtime, or with one that (in an implementation-specific manner) puts stdin into binary mode. All the data is delivered by the shell's piping redirection mechanism.

Windows can. Microsoft C can't, except by resorting to an implemen- tation extension (setmode). This is documented in MS KB article Q68423, for all the good that does you. (Other KB articles note that this breaks fopen's append mode for text files in an unpleasant fashion, too.)

Lit. Buffer overruns 1719
CP-M. You're correct. Though I believe Kildall actually got it from the system he used to develop CP-M, the name of which I can't recall right now. Yes, though on most system they...

I believe this is a holdover from MS-DOS's brain-dead treatment of text files; in MS-DOS, text files could have a file size attribute value that was larger than the actual file contents, and the SUB byte indicated the actual end of the data. Thus stdio *had* to stop at a SUB; there was no other way of correctly detecting the end of a text file, because the OS could return garbage bytes after it.

I strongly doubt there is any good reason for NT-derived Windows C implementations to remain bug-compatible with this stupidity, however.

I must point out that this experiment shows absolutely nothing about the capabilities of redirection or piping in the Windows shell, as TYPE uses neither.

A simple program that echoes stdin to stdout can be used to test this with redirection and piping, and with suitable modifications will demonstrate what I've noted above.

The obvious workaround, using portable C, is to get a better C runtime.

--

Lit. Buffer overruns 1720
Nice turn on topic there. My complements. The ISIS we (at least 'I', I think 'we...

"Well, we're not getting a girl," said Marilla, as if contagioning wells were a purely feminine accomplishment and not to be dreaded in the case of a boy. -- L. M. Montgomery, Anne of Green Gables


List | Previous | Next

Lit. Buffer overruns 1719

Alt Folklore Computers Newsgroups

Lit. Buffer overruns 1717