RE: thoughts on memory usage...

From: David Luyer <luyer@dont-contact.us>
Date: Sun, 24 Aug 1997 20:41:52 +0800 (WST)

--MimeMultipartBoundary
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Fri, 22 Aug 1997, Larmour, Jonathan wrote:
>Okay, how about,
>#define DECODE(a) { char tempstackcharstar[BUFSIZE]; Munge a into
>tempstackcharstar; strncpy(a, tempstackcharstar,
>strlen(tempstackcharstar); return a }
>
>But maybe we shouldn't get bogged down in details of course!

"warning: function returns address of local variable"
"invalid use of void expression"
oh, and if you don't bracket it as ({ }),
"parse error before '{'"
with my standard compiler flags (incl. -Wall -ansi -pedantic)
"warning: ANSI C forbids braced-groups within expressions"

Michael's suggestion was probably the best and most efficient way to do
this kind of thing. It only keeps one array of return buffers, and you're
unlikely to want to compare more than two without taking a copy of them
anyway.

(I wish the implementors of crypt() and getpass() had done something like
this, even rotating between two buffers... I've seen real code with the
obvious security hole strcmp(crypt(...), crypt(...));)

Of course, I now believe the best way to do things is with md5... anyone
done any work on implementing this?

David.

--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:42 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:24 MST