safec 3.8.0
Safe C Library - ISO TR24731 Bounds Checking Interface
|
#include "safe_str_lib.h"
Functions | |
EXPORT constraint_handler_t | set_str_constraint_handler_s (constraint_handler_t handler) |
The set_str_constraint_handler_s function sets the runtime-constraint handler to be handler. | |
EXPORT constraint_handler_t | thrd_set_str_constraint_handler_s (constraint_handler_t handler) |
The thrd_set_str_constraint_handler_s function sets the runtime-constraint handler to a thread-local handler. | |
EXPORT void | invoke_safe_str_constraint_handler (const char *restrict msg, void *restrict ptr, errno_t error) |
Invokes the currently set thread-safe or not constraint handler or the default. | |
int | handle_str_bos_overflow (const char *restrict msg, char *restrict dest, const rsize_t dmax) |
void | handle_str_bos_chk_warn (const char *restrict func, char *restrict dest, const rsize_t dmax, const size_t destbos) |
void | handle_str_src_bos_chk_warn (const char *restrict func, char *restrict dest, const rsize_t smax, const size_t srcbos, const char *srcname, const char *smaxname) |
Variables | |
static constraint_handler_t | str_handler = NULL |
static constraint_handler_t | thrd_str_handler = NULL |
EXPORT constraint_handler_t set_str_constraint_handler_s | ( | constraint_handler_t | handler | ) |
The set_str_constraint_handler_s function sets the runtime-constraint handler to be handler.
The runtime-constraint handler is the function to be called when a library function detects a runtime-constraint violation. Only the most recent handler registered with set_str_constraint_handler_s is called when a runtime-constraint violation occurs. When the handler is called, it is passed the following arguments in the following order:
EXPORT constraint_handler_t thrd_set_str_constraint_handler_s | ( | constraint_handler_t | handler | ) |
The thrd_set_str_constraint_handler_s function sets the runtime-constraint handler to a thread-local handler.
The thrd_set_str_constraint_handler_s function behaves the same way as the set_str_constraint_handler_s function except that it sets the runtime-constraint handler to the handler only for the calling thread and for any threads that are yet to be created by the calling thread. The function has no effect on other threads in the program. The remaining effects of the two functions are identical, as are their return values.
EXPORT void invoke_safe_str_constraint_handler | ( | const char *restrict | msg, |
void *restrict | ptr, | ||
errno_t | error | ||
) |
Invokes the currently set thread-safe or not constraint handler or the default.
Can be disabled via --disable-constraint-handler
*msg | Pointer to the message describing the error. |
*ptr | Pointer to aassociated data. Can be NULL. |
error | The error code encountered. |
int handle_str_bos_overflow | ( | const char *restrict | msg, |
char *restrict | dest, | ||
const rsize_t | dmax | ||
) |
void handle_str_bos_chk_warn | ( | const char *restrict | func, |
char *restrict | dest, | ||
const rsize_t | dmax, | ||
const size_t | destbos | ||
) |
void handle_str_src_bos_chk_warn | ( | const char *restrict | func, |
char *restrict | dest, | ||
const rsize_t | smax, | ||
const size_t | srcbos, | ||
const char * | srcname, | ||
const char * | smaxname | ||
) |
|
static |
|
static |