🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.d
Article #1827

Re: Interesting bug in compress on 88000 Systems

#1827
From: John Tamplin
Date: Tue, 30 Apr 1991 18:09
42 lines
2037 bytes
In article <1416@ecicrl.ocunix.on.ca> clewis@ferret.ocunix.on.ca (Chris Lewis) writes:
>When compress tries to set the time on the file it's just
>created to be the same as the original file, things go a little
>awry.  The code is:
>
>	time_t timep[2];
>	...
>	timep[0] = statbuf.st_atime;
>	timep[1] = statbuf.st_mtime;
>	utime(ofname, timep);	/* Update last accessed and modified times */
>
>On the 88000, (as in 1003.1), timep is actually a struct.  All would be well,
>except on the 88000 they've inserted an additional time_t after the atime
>and the mtime field to contain microseconds....  So, what happens is that
>the atime is set properly, the atime usec field is set to mtime, and the mtime is
>set to garbage (the epoch due to the stack contents in my case).  I'm not sure
>whether this makes the OS/header file noncompliant with 1003.1.
>
>Looks to me that compress.c needs an ifdef so as to use the struct
>definition.

Yes, I would have preffered if the 88k BCS had specified the microsecond
fields after the second fields, ie:
  struct {
	time_t	actime;
	time_t	mtime;
	time_t	acusecs;
	time_t	musecs;
  };

Then it would be harmless to have the microsecond fields set to a random
value, although there would still be some possibility of reading beyond
allocated memory if the structure were at the very end of the data section.

Other notable programs to look out for:  archiving programs (specifically
pax, gnu tar, gnu ar) and a few game programs (one that update the time
of their score file and check it to see if hanky-panky is going on).

-- 
John Tamplin						Xavax
jat@xavax.COM						2104 West Ferry Way
...!uunet!xavax!jat					Huntsville, AL 35801
Technical Details
Message-ID: <1991Apr30.180949.12824@xavax.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!pacbell.com!mips!spool.mu.edu!uunet!xavax!jat

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!pacbell.com!mips!spool.mu.edu!uunet!xavax!jat
From: jat@xavax.com (John Tamplin)
Newsgroups: comp.sources.d
Subject: Re: Interesting bug in compress on 88000 Systems
Message-ID: <1991Apr30.180949.12824@xavax.com>
Date: 30 Apr 91 18:09:49 GMT
Organization: Xavax
Lines: 42