]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
readlink len-1
authorKevin Lo <kevlo@FreeBSD.org>
Tue, 14 Feb 2012 10:17:03 +0000 (10:17 +0000)
committerKevin Lo <kevlo@FreeBSD.org>
Tue, 14 Feb 2012 10:17:03 +0000 (10:17 +0000)
pw/cpdir.c

index c5534e58d3184b57f68c6ce622e57bf92cfec21b..0fd671b049d5949243d56a095b66edc912afe0d3 100644 (file)
@@ -84,7 +84,7 @@ copymkdir(char const * dir, char const * skel, mode_t mode, uid_t uid, gid_t gid
                                                        if (strcmp(e->d_name, ".") != 0 && strcmp(e->d_name, "..") != 0)
                                                                copymkdir(dst, src, st.st_mode & _DEF_DIRMODE, uid, gid);
                                                                chflags(dst, st.st_flags);      /* propagate flags */
-                                                   } else if (S_ISLNK(st.st_mode) && (len = readlink(src, lnk, sizeof(lnk))) != -1) {
+                                                   } else if (S_ISLNK(st.st_mode) && (len = readlink(src, lnk, sizeof(lnk) - 1)) != -1) {
                                                        lnk[len] = '\0';
                                                        symlink(lnk, dst);
                                                        lchown(dst, uid, gid);