savecore.c revisited

utzoo!decvax!pur-ee!purdue!cak utzoo!decvax!pur-ee!purdue!cak
Fri Jan 15 12:20:39 AEST 1982


Ooops, I goofed. In the recently published fix to savecore.c, I forgot
something. It's not good enough to just extend the array size. Here's
the diff that makes the difference:

    *** /usr/src/cmd/savecore.c	Fri Jan 15 11:43:47 1982
    --- /usr/src/cmd/savecore.c.v0	Thu Jan 14 16:40:51 1982
    ***************
    *** 87,93
	    register int dfd = Open("/dev", 0);
	    struct direct dir;
	    struct stat statb;
    ! 	static char devname[DIRSIZ + 6];
	    char *dp;
      
	    strcpy(devname, "/dev/");

    --- 87,93 -----
	    register int dfd = Open("/dev", 0);
	    struct direct dir;
	    struct stat statb;
    ! 	static char devname[DIRSIZ + 1];
	    char *dp;
      
	    strcpy(devname, "/dev/");
    ***************
    *** 95,101
		    if (dir.d_ino == 0)
			    continue;
		    strncpy(devname + 5, dir.d_name, DIRSIZ);
    ! 		devname[DIRSIZ + 6] = '\0';
		    if (stat(devname, &statb)) {
			    perror(devname);
			    continue;

    --- 95,101 -----
		    if (dir.d_ino == 0)
			    continue;
		    strncpy(devname + 5, dir.d_name, DIRSIZ);
    ! 		devname[DIRSIZ] = '\0';
		    if (stat(devname, &statb)) {
			    perror(devname);
			    continue;

Oh the humiliation of incomplete testing!

chris



More information about the Comp.bugs.4bsd.ucb-fixes mailing list