gcc warns that:
warning: 'char* strncpy(char*, const char*, size_t)' specified bound 4096 equals destination size [-Wstringop-truncation]
Return an error when lttng_strncpy reports that a truncation occurred.
Change-Id: I03889d6d275566413df2848974e4d3ad83565b17
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
* return it as is
*/
} else {
- strncpy(resolved_path, path, LTTNG_PATH_MAX);
+ const auto strncpy_ret = lttng_strncpy(resolved_path, path, LTTNG_PATH_MAX);
+ if (strncpy_ret) {
+ goto error;
+ }
}
/* Then we return the 'partially' resolved path */
if (try_path_prev != try_path) {
free(try_path_prev);
}
+
return nullptr;
}