Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site allegra.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mp From: mp@allegra.UUCP (Mark Plotnick) Newsgroups: net.unix-wizards,net.bugs.usg Subject: Re: ls(1) on System V Message-ID: <3411@allegra.UUCP> Date: Fri, 5-Apr-85 18:11:22 EST Article-I.D.: allegra.3411 Posted: Fri Apr 5 18:11:22 1985 Date-Received: Sat, 6-Apr-85 03:26:59 EST References: <176@mplvax.UUCP> Organization: AT&T Bell Laboratories, Murray Hill Lines: 35 Xref: watmath net.unix-wizards:12718 net.bugs.usg:207 Well, the problem is that in the readdir() routine, the code is doing strlen(dentry.d_name), and d_name isn't null-terminated if it's 14 characters long (I think strlen returns 44 or so). Now if you have a binary distribution, all is not lost; since dentry is the only automatic variable in the readdir() routine, you can increase your chances of finding a null at the end of the structure by increasing the amount of automatic space the routine allocates. I changed the .s file and assembled it and this works until you start asking ls to list more than one directory at a time. *** old Fri Apr 5 17:41:31 1985 --- new Fri Apr 5 17:42:33 1985 *************** *** 1,6 readdir() 8080112e: 10 47 SAVE %r7 ! 80801130: 9c 10 4c ADDW2 &0x10,%sp 80801133: a0 5a PUSHW 0(%ap) 80801135: a0 4f c5 14 88 80 PUSHW &0x808814c5 8080113b: 2c cc f8 7f a8 44 80 80 CALL 0xf8(%sp),$0x808044a8 --- 1,6 ----- readdir() 8080112e: 10 47 SAVE %r7 ! 80801130: 9c 14 4c ADDW2 &0x14,%sp 80801133: a0 5a PUSHW 0(%ap) 80801135: a0 4f c5 14 88 80 PUSHW &0x808814c5 8080113b: 2c cc f8 7f a8 44 80 80 CALL 0xf8(%sp),$0x808044a8 Lacking adb (they don't offer it on 3b's) and sufficient knowledge about the COFF, I can't offer a sure-fire way to patch the binary, though. Mark Plotnick allegra!mp