The branch, master has been updated
       via  c3761706 Make sure that some memory zeroing always happens.
      from  48163179 Avoid a yodl macro warning.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c37617064494ecc2da52f2da97aa8768f75f247f
Author: Wayne Davison <way...@samba.org>
Date:   Tue Jan 8 14:46:41 2019 -0800

    Make sure that some memory zeroing always happens.

-----------------------------------------------------------------------

Summary of changes:
 authenticate.c | 8 ++++----
 fileio.c       | 4 +++-
 util.c         | 8 ++++++++
 3 files changed, 15 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/authenticate.c b/authenticate.c
index eca5baf1..8534a0b2 100644
--- a/authenticate.c
+++ b/authenticate.c
@@ -162,8 +162,8 @@ static const char *check_secret(int module, const char 
*user, const char *group,
 
        fclose(fh);
 
-       memset(line, 0, sizeof line);
-       memset(pass2, 0, sizeof pass2);
+       force_memzero(line, sizeof line);
+       force_memzero(pass2, sizeof pass2);
 
        return err;
 }
@@ -318,8 +318,8 @@ char *auth_server(int f_in, int f_out, int module, const 
char *host,
                err = check_secret(module, line, group, challenge, pass);
        }
 
-       memset(challenge, 0, sizeof challenge);
-       memset(pass, 0, strlen(pass));
+       force_memzero(challenge, sizeof challenge);
+       force_memzero(pass, strlen(pass));
 
        if (auth_uid_groups) {
                int j;
diff --git a/fileio.c b/fileio.c
index b183e200..3f55e708 100644
--- a/fileio.c
+++ b/fileio.c
@@ -322,7 +322,9 @@ int unmap_file(struct map_struct *map)
                map->p = NULL;
        }
        ret = map->status;
-       memset(map, 0, sizeof map[0]);
+#if 0 /* I don't think we really need this. */
+       force_memzero(map, sizeof map[0]);
+#endif
        free(map);
 
        return ret;
diff --git a/util.c b/util.c
index 72b3944f..fbbfd8ba 100644
--- a/util.c
+++ b/util.c
@@ -1682,3 +1682,11 @@ void *expand_item_list(item_list *lp, size_t item_size,
        }
        return (char*)lp->items + (lp->count++ * item_size);
 }
+
+/* This zeroing of memory won't be optimized away by the compiler. */
+void force_memzero(void *buf, size_t len)
+{
+    volatile uchar *z = buf;
+    while (len-- > 0)
+       *z++ = '\0';
+}


-- 
The rsync repository.

_______________________________________________
rsync-cvs mailing list
rsync-cvs@lists.samba.org
https://lists.samba.org/mailman/listinfo/rsync-cvs

Reply via email to