char current_working_directory[PATH_MAX];
char temp_path[PATH_MAX];
if (getcwd(current_working_directory, PATH_MAX)) {
- snprintf(temp_path, PATH_MAX, "%s/%s", current_working_directory, path);
- 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;
+ if (strlen(current_working_directory) + strlen(path) <= PATH_MAX) {
+ snprintf(temp_path, PATH_MAX, "%s/%s", current_working_directory, path);
+ 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;
+ }
}
}
}