1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
2 
3 #ifndef SAFE_C_STRINGS_H
4 #define SAFE_C_STRINGS_H
5 
6 #include <stddef.h>
7 
8 #ifdef	__cplusplus
9 extern "C" {
10 #endif
11 
12 /**
13  * @name safe_string_manipulation
14  * These functions ensure that no buffer overrun occurs, and that the
15  * destination strings are always terminated with '\0', as long as the
16  * destination buffer has space for at least one character.
17  */
18 ///@{
19 
20 /// @see strncpy
21 int safe_strcpy(char* destination, size_t destinationSize, const char* source);
22 
23 /// @see strncat
24 int safe_strcat(char* destination, size_t destinationSize, const char* source);
25 
26 #define STRCPY_T safe_strcpy
27 #define STRCAT_T safe_strcat
28 ///@}
29 
30 #ifdef	__cplusplus
31 } /* extern "C" */
32 #endif
33 
34 #endif /* SAFE_C_STRINGS_H */
35