]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Add new code to recv_group_name() too.
authorWayne Davison <wayne@opencoder.net>
Mon, 13 Jul 2020 20:43:17 +0000 (13:43 -0700)
committerWayne Davison <wayne@opencoder.net>
Mon, 13 Jul 2020 20:43:17 +0000 (13:43 -0700)
uidlist.c

index 6e9bb3c1388eda13f240bcefe54e656e42ccca00..4506de2e033a7ca1016a271facbb663c822445ae 100644 (file)
--- a/uidlist.c
+++ b/uidlist.c
@@ -390,12 +390,18 @@ gid_t recv_group_name(int f, gid_t gid, uint16 *flags_ptr)
 {
        struct idlist *node;
        int len = read_byte(f);
-       char *name = new_array(char, len+1);
-       read_sbuf(f, name, len);
-       if (numeric_ids < 0) {
-               free(name);
+       char *name;
+
+       if (len) {
+               name = new_array(char, len+1);
+               read_sbuf(f, name, len);
+               if (numeric_ids < 0) {
+                       free(name);
+                       name = NULL;
+               }
+       } else
                name = NULL;
-       }
+
        node = recv_add_id(&gidlist, gidmap, gid, name); /* node keeps name's memory */
        if (flags_ptr && node->flags & FLAG_SKIP_GROUP)
                *flags_ptr |= FLAG_SKIP_GROUP;