From 51f79b9de8cea1fc34b40da2294874e48355af93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 6 Jul 2012 18:46:25 +0200 Subject: [PATCH] do not pass incorrect length to remember_include_file() --- ccache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ccache.c b/ccache.c index 926d6b2..0cc1a3c 100644 --- a/ccache.c +++ b/ccache.c @@ -307,7 +307,7 @@ get_path_in_cache(const char *name, const char *suffix) * also updated. Takes over ownership of path. */ static void -remember_include_file(char *path, size_t path_len, struct mdfour *cpp_hash) +remember_include_file(char *path, struct mdfour *cpp_hash) { #ifdef _WIN32 DWORD attributes; @@ -318,6 +318,7 @@ remember_include_file(char *path, size_t path_len, struct mdfour *cpp_hash) size_t size; int result; bool is_pch; + size_t path_len = strlen(path); if (path_len >= 2 && (path[0] == '<' && path[path_len - 1] == '>')) { /* Typically or . */ @@ -528,7 +529,7 @@ process_preprocessed_file(struct mdfour *hash, const char *path) path = x_strndup(p, q - p); path = make_relative_path(path); hash_string(hash, path); - remember_include_file(path, q - p, hash); + remember_include_file(path, hash); p = q; } else { q++; @@ -544,7 +545,7 @@ process_preprocessed_file(struct mdfour *hash, const char *path) char *path = x_strdup(included_pch_file); path = make_relative_path(path); hash_string(hash, path); - remember_include_file(path, strlen(included_pch_file), hash); + remember_include_file(path, hash); } return true;