memset_s()

Updated: October 26, 2022

Securely set memory to a given value

Synopsis:

#include <string.h>

errno_t memset_s( void *s,
                  rsize_t smax,
                  int c,
                  size_t n );

Arguments:

s
A pointer to the memory that you want to set. This must not be NULL.
smax
The maximum size of the block of memory.
c
The value that you want to store in each byte.
n
The number of bytes to set. This value must not be greater than the value of smax.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The memset_s() function is a secure version of memset():

Returns:

EOK
Success.
EINVAL
The s argument is NULL, or n is greater than smax.

Classification:

C11

Safety:  
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes