[riot-notifications] [RIOT-OS/RIOT] hashes/sha256: don't call memcpy if len==0 (#10795)

Martine Lenders notifications at github.com
Thu Jan 17 11:09:46 CET 2019


miri64 approved this pull request.

Apart from a minor code style thing I'm fine with this change. I did not expect them to fail, but `unittests` pass also still. So ACK.

> @@ -223,7 +223,9 @@ void sha256_update(sha256_context_t *ctx, const void *data, size_t len)
 
     /* Handle the case where we don't need to perform any transforms */
     if (len < 64 - r) {
-        memcpy(&ctx->buf[r], data, len);
+        if (len > 0) {

Just a suggestion but how about pulling up the expression into the `if` above with an `&& (len > 0)`?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10795#pullrequestreview-193544155
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190117/b2714dd1/attachment.html>


More information about the notifications mailing list