mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 04:47:14 +02:00
* Protect from getenv("HOME") returning nullptr (e.g., in case running in systemd) * Write proper warning in Module.cpp Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
This commit is contained in:
@ -20,6 +20,7 @@ Still this is better than strcpy and a buffer overflow...
|
||||
*/
|
||||
template <size_t array_size>
|
||||
void strcpy_safe(char (&destination)[array_size], const char *source) {
|
||||
assert(source != nullptr);
|
||||
assert(array_size > strlen(source));
|
||||
strncpy(destination, source, array_size - 1);
|
||||
destination[array_size - 1] = '\0';
|
||||
|
Reference in New Issue
Block a user