explicit\_bzero(3bsd) 3bsd explicit\_bzero(3bsd)

# [NAME](#NAME)

`explicit_bzero` — write zeroes to a byte string

# [LIBRARY](#LIBRARY)

library “libbsd”

# [SYNOPSIS](#SYNOPSIS)

`#include <string.h>` (See [libbsd(7)](/man/os/libbsd/libbsd.7) for include usage.)  
`void`  
`explicit_bzero`(`void *buf`, `size_t len`);

# [DESCRIPTION](#DESCRIPTION)

The [`explicit_bzero`](#explicit_bzero)() function writes `len` zero bytes to the string `buf`. If `len` is zero, `explicit_bzero`() does nothing.

The [`explicit_bzero`](#explicit_bzero~2)() variant behaves the same as the [`bzero`](#bzero)() function, but will not be removed by a compiler's dead store optimization pass, making it useful for clearing sensitive memory such as a password.

# [SEE ALSO](#SEE_ALSO)

[bzero(3)](/man/os/libbsd/bzero.3), [memset(3)](/man/os/libbsd/memset.3), [swab(3)](/man/os/libbsd/swab.3)

# [HISTORY](#HISTORY)

The `explicit_bzero`() function first appeared in OpenBSD 5.5, glibc 2.25.

January 22, 2014 Linux 4.19.0-gvisor

---

Document: explicit_bzero(3bsd) from libbsd 0.12.2-r11 (Chainguard OS)
Source: https://gitlab.freedesktop.org/libbsd/libbsd
