--- a/flist.c +++ b/flist.c @@ -1249,7 +1249,15 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, basename_len = strlen(basename) + 1; /* count the '\0' */ #ifdef SUPPORT_LINKS - linkname_len = S_ISLNK(st.st_mode) ? strlen(linkname) + 1 : 0; + if (S_ISLNK(st.st_mode)) { + linkname_len = strlen(linkname) + 1; + if (linkname_len == 0 + 1) { + io_error |= IOERR_GENERAL; + rprintf(FERROR_XFER, "skipping symlink with no target: %s\n", fname); + return NULL; + } + } else + linkname_len = 0; #else linkname_len = 0; #endif