SLOG(LOG_DEBUG, vc_info_tag(), "[DEBUG] %s is real file, not symbolic link", path);
*is_symbolic = false;
} else {
- char current_working_directory[PATH_MAX];
- char temp_path[PATH_MAX*2];
+ char current_working_directory[PATH_MAX + 1] = {'\0', };
+ char temp_path[PATH_MAX + 1] = {'\0', };
if (getcwd(current_working_directory, PATH_MAX)) {
- if (strlen(current_working_directory) + strlen(path) <= PATH_MAX*2) {
- snprintf(temp_path, PATH_MAX*2, "%s/%s", current_working_directory, path);
- if (strncmp(temp_path, real_path, strlen(temp_path) + 1) == 0) {
+ if (strlen(current_working_directory) + strlen(path) < PATH_MAX) {
+ int ret = snprintf(temp_path, PATH_MAX, "%s/%s", current_working_directory, path);
+ if (ret < 0) {
+ SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Error occurred while concatenating paths : %s %s",
+ current_working_directory, path);
+ } else if (strncmp(temp_path, real_path, strlen(temp_path) + 1) == 0) {
SLOG(LOG_DEBUG, vc_info_tag(), "[DEBUG] %s is real file, not symbolic link", path);
*is_symbolic = false;
}