diff -ru sbin/fsck.orig/fsutil.c sbin/fsck/fsutil.c --- sbin/fsck.orig/fsutil.c 2003-11-01 15:15:58.000000000 -0200 +++ sbin/fsck/fsutil.c 2004-09-23 20:48:55.000000000 -0300 @@ -231,9 +231,10 @@ statfsp = &mntbuf[i]; devname = statfsp->f_mntfromname; if (*devname != '/') { - strcpy(device, _PATH_DEV); - strcat(device, devname); - strcpy(statfsp->f_mntfromname, device); + snprintf(device, sizeof(device), "%s%s", + _PATH_DEV, devname); + strlcpy(statfsp->f_mntfromname, device, + sizeof(statfsp->f_mntfromname)); } if (isdev == 0) { if (strcmp(name, statfsp->f_mntonname)) diff -ru sbin/fsck.orig/inode.c sbin/fsck/inode.c --- sbin/fsck.orig/inode.c 2004-02-04 15:39:59.000000000 -0200 +++ sbin/fsck/inode.c 2004-09-23 20:46:10.000000000 -0300 @@ -173,8 +173,9 @@ for (ap = &bp->b_un.b_indir[nif]; ap < aplim; ap++) { if (*ap == 0) continue; - (void)sprintf(buf, "PARTIALLY TRUNCATED INODE I=%lu", - (u_long)idesc->id_number); + snprintf(buf, sizeof(buf), + "PARTIALLY TRUNCATED INODE I=%lu", + (u_long)idesc->id_number); if (dofix(idesc, buf)) { *ap = 0; dirty(bp); diff -ru sbin/fsck.orig/main.c sbin/fsck/main.c --- sbin/fsck.orig/main.c 2004-02-04 15:39:59.000000000 -0200 +++ sbin/fsck/main.c 2004-09-23 20:49:12.000000000 -0300 @@ -389,8 +389,8 @@ continue; devname = mntbuf[i].f_mntfromname; if (*devname != '/') { - strcpy(device, _PATH_DEV); - strcat(device, devname); + snprintf(device, sizeof(device), "%s%s", + _PATH_DEV, devname); devname = device; } if (stat(devname, &mntdevstat) == 0 && diff -ru sbin/fsck.orig/pass2.c sbin/fsck/pass2.c --- sbin/fsck.orig/pass2.c 2004-02-04 15:39:59.000000000 -0200 +++ sbin/fsck/pass2.c 2004-09-23 20:46:10.000000000 -0300 @@ -260,7 +260,7 @@ else proto.d_type = 0; proto.d_namlen = 1; - (void)strcpy(proto.d_name, "."); + strlcpy(proto.d_name, ".", sizeof(proto.d_name)); # if BYTE_ORDER == LITTLE_ENDIAN if (!newinofmt) { u_char tmp; @@ -303,7 +303,7 @@ else proto.d_type = 0; proto.d_namlen = 2; - (void)strcpy(proto.d_name, ".."); + strlcpy(proto.d_name, "..", sizeof(proto.d_name)); # if BYTE_ORDER == LITTLE_ENDIAN if (!newinofmt) { u_char tmp; diff -ru sbin/fsck.orig/preen.c sbin/fsck/preen.c --- sbin/fsck.orig/preen.c 2004-02-04 15:39:59.000000000 -0200 +++ sbin/fsck/preen.c 2004-09-23 20:46:10.000000000 -0300 @@ -221,7 +221,7 @@ fprintf(stderr, "out of memory"); exit (8); } - (void)strncpy(dk->name, name, len); + strlcpy(dk->name, name, len + 1); dk->name[len] = '\0'; dk->part = NULL; dk->next = NULL; @@ -250,12 +250,12 @@ fprintf(stderr, "out of memory"); exit (8); } - (void)strcpy(pt->name, name); + strlcpy(pt->name, name, strlen(name)+1); if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) { fprintf(stderr, "out of memory"); exit (8); } - (void)strcpy(pt->fsname, fsname); + strlcpy(pt->fsname, fsname, strlen(fsname) + 1); pt->next = NULL; pt->auxdata = auxdata; } diff -ru sbin/fsck.orig/utilities.c sbin/fsck/utilities.c --- sbin/fsck.orig/utilities.c 2004-02-04 15:39:59.000000000 -0200 +++ sbin/fsck/utilities.c 2004-09-23 20:46:10.000000000 -0300 @@ -433,13 +433,13 @@ static int busy = 0; if (curdir == ino && ino == ROOTINO) { - (void)strcpy(namebuf, "/"); + strlcpy(namebuf, "/", MAXPATHLEN + 1); return; } if (busy || (inoinfo(curdir)->ino_state != DSTATE && inoinfo(curdir)->ino_state != DFOUND)) { - (void)strcpy(namebuf, "?"); + strlcpy(namebuf, "?", MAXPATHLEN + 1); return; } busy = 1;