diff options
-rw-r--r-- | ls.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -203,8 +203,10 @@ static int ls_dir(const char *dir, int showdirname) } else { blocks += files[nfiles].st.st_blocks; if (S_ISLNK(files[nfiles].st.st_mode)) { - readlinkat(dfd, de->d_name, files[nfiles].link, + size_t n = readlinkat(dfd, de->d_name, + files[nfiles].link, sizeof(files[nfiles].link)); + files[nfiles].link[n] = '\0'; fstatat(dfd, de->d_name, &files[nfiles].lstat, 0); } nfiles++; |