Add link to the message that introduced string_area.
[rsync/rsync.git] / flist.c
diff --git a/flist.c b/flist.c
index 843cf9e..c28159a 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -25,6 +25,8 @@
  * allocating blocks is the responsibility of the system's malloc
  * library, not of rsync.
  *
+ * @sa http://lists.samba.org/pipermail/rsync/2000-June/002351.html
+ *
  **/
 
 #include "rsync.h"
@@ -375,7 +377,7 @@ static void receive_file_entry(struct file_struct **fptr,
        static gid_t last_gid;
        static char lastname[MAXPATHLEN];
        char thisname[MAXPATHLEN];
-       int l1=0,l2=0;
+       unsigned int l1=0,l2=0;
        char *p;
        struct file_struct *file;
 
@@ -442,6 +444,10 @@ static void receive_file_entry(struct file_struct **fptr,
 
        if (preserve_links && S_ISLNK(file->mode)) {
                int l = read_int(f);
+               if (l < 0) {
+                       rprintf(FERROR,"overflow: l=%d\n", l);
+                       overflow("receive_file_entry");
+               }
                file->link = (char *)malloc(l+1);
                if (!file->link) out_of_memory("receive_file_entry 2");
                read_sbuf(f,file->link,l);