resurrecting-open-source-projects / dcfldd

Enhanced version of dd for forensics and security
GNU General Public License v2.0
90 stars 19 forks source link

sha2: fix another instance of -Wsizeof-pointer-memaccess #26

Closed thesamesam closed 3 months ago

thesamesam commented 3 months ago

When reviewing https://github.com/resurrecting-open-source-projects/dcfldd/pull/24, @davidpolverari pointed out a mistake I made in one revision - oops.

While fixing that, I noticed:

sha2.c: In function ‘SHA384_End’:
sha2.c:1052:45: error: argument to ‘sizeof’ in ‘memset’ call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
 1052 |                 MEMSET_BZERO(context, sizeof(context));
      |                                             ^
sha2.c:176:49: note: in definition of macro ‘MEMSET_BZERO’
  176 | #define MEMSET_BZERO(p,l)       memset((p), 0, (l))
      |                                                 ^
cc1: some warnings being treated as errors

Let's fix that too, while we're at it.

davidpolverari commented 3 months ago

Merged. Thanks again!

davidpolverari commented 3 months ago

Well, I saw there are other instances of it. I will add them in another commit.

thesamesam commented 3 months ago

Oops, I didn't git add -p the rest. Thanks for fixing :)

davidpolverari commented 3 months ago

It happens! Don't worry :) Thanks!