Menu

#8 Incorrect memset size

v1.0_(example)
open
nobody
None
5
2025-08-18
2025-08-18
No

In radlib 2.12.0:

../src/radsha.c:477:32: warning: 'memset' call operates on objects of type 'struct SHA1Context' while the size is based on a different type 'struct SHA1Context *' [-Wsizeof-pointer-memaccess]
    memset (context, 0, sizeof(context));   /* In case it's sensitive */
            ~~~~~~~            ^~~~~~~
../src/radsha.c:477:32: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
    memset (context, 0, sizeof(context));   /* In case it's sensitive */
                               ^~~~~~~
../src/radsha.c:499:36: warning: 'memset' call operates on objects of type 'struct SHA1Context' while the size is based on a different type 'struct SHA1Context *' [-Wsizeof-pointer-memaccess]
        memset (context, 0, sizeof(context));
                ~~~~~~~            ^~~~~~~
../src/radsha.c:499:36: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
        memset (context, 0, sizeof(context));
                                   ^~~~~~~
../src/radsha.c:736:32: warning: 'memset' call operates on objects of type 'SHA256_CTX' (aka 'struct _SHA256_CTX') while the size is based on a different type 'SHA256_CTX *' (aka 'struct _SHA256_CTX *') [-Wsizeof-pointer-memaccess]
    memset (context, 0, sizeof(context));
            ~~~~~~~            ^~~~~~~
../src/radsha.c:736:32: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
    memset (context, 0, sizeof(context));
                               ^~~~~~~
../src/radsha.c:759:36: warning: 'memset' call operates on objects of type 'SHA256_CTX' (aka 'struct _SHA256_CTX') while the size is based on a different type 'SHA256_CTX *' (aka 'struct _SHA256_CTX *') [-Wsizeof-pointer-memaccess]
        memset (context, 0, sizeof(context));
                ~~~~~~~            ^~~~~~~
../src/radsha.c:759:36: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
        memset (context, 0, sizeof(context));
                                   ^~~~~~~
4 warnings generated.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.