2022-11-27 Paul Eggert <eggert@cs.ucla.edu>
+ read-file: use memset_explicit
+ * lib/read-file.c (fread_file, read_file):
+ Use memset_explicit instead of explicit_bzero.
+ * modules/read-file (Depends-on): Depend on memset_explicit
+ instead of on explicit_bzero.
+
memset_explicit: new module
* doc/posix-functions/memset_explicit.texi, lib/memset_explicit.c:
* m4/memset_explicit.m4, modules/memset_explicit:
/* Get malloc, realloc, free. */
#include <stdlib.h>
-/* Get explicit_bzero, memcpy. */
+/* Get memcpy, memset_explicit. */
#include <string.h>
/* Get errno. */
{
char *smaller_buf = malloc (size + 1);
if (smaller_buf == NULL)
- explicit_bzero (buf + size, alloc - size);
+ memset_explicit (buf + size, 0, alloc - size);
else
{
memcpy (smaller_buf, buf, size);
- explicit_bzero (buf, alloc);
+ memset_explicit (buf, 0, alloc);
free (buf);
buf = smaller_buf;
}
break;
}
memcpy (new_buf, buf, save_alloc);
- explicit_bzero (buf, save_alloc);
+ memset_explicit (buf, 0, save_alloc);
free (buf);
}
else if (!(new_buf = realloc (buf, alloc)))
}
if (flags & RF_SENSITIVE)
- explicit_bzero (buf, alloc);
+ memset_explicit (buf, 0, alloc);
free (buf);
errno = save_errno;
if (out)
{
if (flags & RF_SENSITIVE)
- explicit_bzero (out, *length);
+ memset_explicit (out, 0, *length);
free (out);
}
return NULL;