diff options
| author | Eric Biggers <ebiggers@google.com> | 2021-12-19 21:20:54 -0600 |
|---|---|---|
| committer | Eric Biggers <ebiggers@google.com> | 2021-12-19 21:43:34 -0600 |
| commit | 546dd336d15251981bb8bcb30c159d0a39bb387e (patch) | |
| tree | 12fd2292652b5ccc8e31ff82773b6a8b5213b1ae | |
| parent | 360467d0df626d2d0eac003a0a210814910804ce (diff) | |
pam: avoid compiler warning in copyIntoSecret()
gcc 11 enabled -Wmaybe-uninitialized by default. It causes a
false-positive warning in copyIntoSecret() because gcc doesn't
understand that mlock() is special and doesn't read from the memory.
Just initialize the memory to avoid this warning.
| -rw-r--r-- | pam/pam.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -93,7 +93,7 @@ void freeArray(pam_handle_t* pamh, void** array, int error_status) { void* copyIntoSecret(void* data) { size_t size = strlen(data) + 1; // include null terminator - void* copy = malloc(size); + void* copy = calloc(1, size); // initialize to avoid a compiler warning mlock(copy, size); memcpy(copy, data, size); return copy; |