Add strlcpy implementation (#2395)
This commit is contained in:
@@ -2245,6 +2245,18 @@ extern "C" {
|
||||
void* ndpi_memmem(const void* haystack, size_t haystack_len, const void* needle,
|
||||
size_t needle_len);
|
||||
|
||||
/**
|
||||
* Copies up to -dst_len - 1- characters from -src- to -dst-, ensuring the result is
|
||||
* null-terminated. Measures -src- length and handles potential null pointers.
|
||||
*
|
||||
* @par dst = destination buffer
|
||||
* @par src = source string
|
||||
* @par dst_len = size of the destination buffer, includes the null terminator
|
||||
*
|
||||
* @return Length of `src`. If greater or equal to -dst_len-, -dst- has been truncated.
|
||||
*/
|
||||
size_t ndpi_strlcpy(char* dst, const char* src, size_t dst_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user