Article View: comp.sys.amiga.tech
Article #9185Re: 020 and 32 bit memory
From: Tomas G. Rokicki
Date: Thu, 23 Jun 1988 06:14
Date: Thu, 23 Jun 1988 06:14
23 lines
1486 bytes
1486 bytes
Here's another thing that could break a 68020 machine that I just
realized. If you *ever* do something like:
char *copystr(s) char *s ; { return(strcpy(mymalloc(strlen(s)),s)) ; }
(not as though I'm advocating that style of programming) but where
mymalloc grabs a chunk of memory, from a previously allocated chunk
or from the system, (and presumably checks for NULL), this could
well work on a 68000 system for a long time. You'll overwrite the
next byte with a 0, but if that next byte is a pointer, you'll never
notice on a '000, but an '020 will break.
I've been bitten with malloc(strlen), so be careful! Sometimes it's
a lot more subtle, if you add constants or something because you did
a strcat() and are off by one or something . . .
-tom
--
/-- Tomas Rokicki /// Box 2081 Stanford, CA 94309
/ o Radical Eye Software /// (TAMU EE '85) (415) 326-5312
\ / | . . . or I \\\///Join CCFFAALW---Concerned Citzens
V | won't get dressed \XX/Fighting For An Acronym-Less World
Technical Details
Message-ID:
<3101@polya.Stanford.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!pasteur!agate!eos!labrea!polya!rokickiReferences:
<6339@well.UUCP> <6756@cup.portal.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!pasteur!agate!eos!labrea!polya!rokicki From: rokicki@polya.Stanford.EDU (Tomas G. Rokicki) Newsgroups: comp.sys.amiga.tech Subject: Re: 020 and 32 bit memory Message-ID: <3101@polya.Stanford.EDU> Date: 23 Jun 88 06:14:10 GMT References: <6339@well.UUCP> <6756@cup.portal.com> Reply-To: rokicki@polya.Stanford.EDU (Tomas G. Rokicki) Organization: Stanford University Lines: 23