Path: utzoo!mnetor!uunet!husc6!bloom-beacon!gatech!uflorida!codas!cpsc6a!atl2!akgua!mtunx!whuts!homxb!antique!cjp From: cjp@antique.UUCP (Charles Poirier) Newsgroups: comp.sys.amiga Subject: Re: calling all gurus Message-ID: <2161@antique.UUCP> Date: 9 Apr 88 01:47:19 GMT References: <8804051628.AA27845@decwrl.dec.com| <3482@ece-csc.UUCP| <8190@oberon.USC.EDU| <3484@ece-csc.UUCP| <8214@oberon.USC.EDU> Reply-To: cjp@vax135.UUCP (Charles Poirier) Organization: AT&T Bell Labs, Holmdel, NJ Lines: 20 Summary: prefs file sanity check In article <8214@oberon.USC.EDU> papa@pollux.usc.edu (Marco Papa) writes: ||]In article <3482@ece-csc.UUCP| rss@ece-csc.UUCP (Ralph Scherp) writes: ||]| fd = open("Devs:System-configuration",O_RDONLY,0); ||] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ||]| read the data into a struct Preferences ||]| read(fd,&pref,sizeof(pref)); ||] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ||]| (where "pref" is "struct Preference pref") |... You'll have to do a lot |of checking to ensure that ALL values are within appropriate ranges, BEFORE |you do the SetPrefs. This will require a little more work than what you |described. An easy hack would be to just check that the length of the file looks right. The chances of specifying a garbage file with the proper length are small enough. -- Charles Poirier (decvax,ihnp4,attmail)!vax135!cjp "Docking complete... Docking complete... Docking complete..."