Index: lib/libstand/bootp.c =================================================================== --- lib/libstand/bootp.c +++ lib/libstand/bootp.c @@ -132,7 +132,6 @@ bp->bp_hlen = 6; bp->bp_xid = htonl(d->xid); MACPY(d->myea, bp->bp_chaddr); - strncpy(bp->bp_file, bootfile, sizeof(bp->bp_file)); bcopy(vm_rfc1048, bp->bp_vend, sizeof(vm_rfc1048)); #ifdef SUPPORT_DHCP bp->bp_vend[4] = TAG_DHCP_MSGTYPE; Index: lib/libstand/nfs.c =================================================================== --- lib/libstand/nfs.c +++ lib/libstand/nfs.c @@ -445,7 +445,7 @@ char buf[2 * NFS_FHSIZE + 3]; u_char *fh; char *cp; - int i; + int error, i; #ifndef NFS_NOSYMLINK struct nfs_iodesc *newfd; struct nfsv2_fattrs *fa; @@ -454,10 +454,12 @@ char namebuf[NFS_MAXPATHLEN + 1]; char linkbuf[NFS_MAXPATHLEN + 1]; int nlinks = 0; -#endif - int error; char *path; + newfd = NULL; + path = NULL; +#endif + #ifdef NFS_DEBUG if (debug) printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); @@ -503,7 +505,7 @@ setenv("boot.nfsroot.nfshandle", buf, 1); /* Allocate file system specific data structure */ - currfd = malloc(sizeof(*newfd)); + currfd = malloc(sizeof(*currfd)); if (currfd == NULL) { error = ENOMEM; goto out; @@ -511,7 +513,6 @@ #ifndef NFS_NOSYMLINK bcopy(&nfs_root_node, currfd, sizeof(*currfd)); - newfd = NULL; cp = path = strdup(upath); if (path == NULL) { @@ -604,10 +605,6 @@ } error = 0; - -out: - free(newfd); - free(path); #else currfd->iodesc = desc; @@ -619,11 +616,16 @@ return (0); } +out: #ifdef NFS_DEBUG if (debug) printf("nfs_open: %s lookupfh failed: %s\n", path, strerror(error)); #endif +#ifndef NFS_NOSYMLINK + free(newfd); + free(path); +#endif free(currfd); return (error); @@ -1087,7 +1089,7 @@ char buf[2 * NFS_V3MAXFHSIZE + 3]; u_char *fh; char *cp; - int i; + int error, i; #ifndef NFS_NOSYMLINK struct nfs_iodesc *newfd; struct nfsv3_fattrs *fa; @@ -1096,10 +1098,12 @@ char namebuf[NFS_MAXPATHLEN + 1]; char linkbuf[NFS_MAXPATHLEN + 1]; int nlinks = 0; -#endif - int error; char *path; + path = NULL; + newfd = NULL; +#endif + #ifdef NFS_DEBUG if (debug) printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); @@ -1148,14 +1152,13 @@ setenv("boot.nfsroot.nfshandlelen", buf, 1); /* Allocate file system specific data structure */ - currfd = malloc(sizeof(*newfd)); + currfd = malloc(sizeof(*currfd)); if (currfd == NULL) { error = ENOMEM; goto out; } #ifndef NFS_NOSYMLINK bcopy(&nfs_root_node, currfd, sizeof(*currfd)); - newfd = NULL; cp = path = strdup(upath); if (path == NULL) { @@ -1252,10 +1255,6 @@ } error = 0; - -out: - free(newfd); - free(path); #else currfd->iodesc = desc; @@ -1268,11 +1267,16 @@ return (0); } +out: #ifdef NFS_DEBUG if (debug) printf("nfs_open: %s lookupfh failed: %s\n", path, strerror(error)); #endif +#ifndef NFS_NOSYMLINK + free(newfd); + free(path); +#endif free(currfd); return (error);