home *** CD-ROM | disk | FTP | other *** search
- Article 770 of net.bugs.4bsd:
- Path: ubc-cs!ubc-ean!alberta!ihnp4!mhuxn!mhuxr!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!elsie!ado
- From: ado@elsie.UUCP (Arthur David Olson)
- Subject: 4.?bsd dbm's store(k,c) dies if (i=k.dsize+c.dsize)==1018||i==1019--FIX
- Date: Wed, 10-Apr-85 09:02:36 PST
- Date-Received: Thu, 11-Apr-85 13:03:49 PST
- Organization: NIH-LEC, Bethesda, MD
-
- Index: lib/libdbm/dbm.c Fix
-
- Description:
- 4.?bsd dbm's store function misbehaves if the sum of the key data
- size and content data size is either 1018 or 1019.
-
- Repeat-By:
- Compile this program with the "dbm" library:
-
- typedef struct {
- char * dptr;
- int dsize;
- } datum;
-
- char buf[1024];
-
- main(argc, argv)
- int argc;
- char * argv[];
- {
- int result;
- datum key;
- datum content;
-
- key.dptr = content.dptr = buf;
- key.dsize = atoi(argv[1]);
- content.dsize = 0;
- creat("fake.dir", 0600);
- creat("fake.pag", 0600);
- dbminit("fake");
- result = store(key, content);
- printf("%d\n", result);
- }
-
- Then run the program. If you use commands such as
- a.out 0
- a.out 1
- ...
- a.out 1017
- things go swimmingly. If you use commands such as
- a.out 1019
- a.out 1020
- ...
- an error message is (correctly) produced. But if you use either
- the command
- a.out 1018
- or
- a.out 1019
- things go wild.
-
- Fix:
- As usual, the trade secret status of the code involved precludes a
- clearer posting. The fix is to change one line in "dbm.c"; it
- causes an error message to be produced in the 1018/1019 cases:
-
- #ifdef OLDVERSION
- if(key.dsize+dat.dsize+2*sizeof(short) >= PBLKSIZ) {
- #else
- if(key.dsize+dat.dsize+3*sizeof(short) >= PBLKSIZ) {
- #endif
- --
- Bugs is a Warner Brothers trademark
- --
- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA
- DEC, VAX and Elsie are Digital Equipment and Borden trademarks
-
-
-