Utility functions that are missing in

string.h More...

Detailed Description

string.h

This header provides utility functions that the standard C libs string.h lacks, such as explicit_bzero

Files

file  string_utils.h
 Utility functions that are missing in string.h
 

Functions

static void explicit_bzero (void *dest, size_t n_bytes)
 Like memset(dest, 0, n_bytes), but secure. More...
 

Function Documentation

◆ explicit_bzero()

static void explicit_bzero ( void *  dest,
size_t  n_bytes 
)
inlinestatic

Like memset(dest, 0, n_bytes), but secure.

Unlike memset(dest, 0, n_bytes), this will zero out the memory even in cases the compiler would optimize out the call to memset().

Note
This is only sensible to use for sensitive data. For non-sensitive data, keep using memset() for performance reasons.
Parameters
[in,out]destMemory to clear
[in]n_bytesSize of memory to clear in bytes

Definition at line 64 of file string_utils.h.