From: Luboš Luňák Date: Fri, 6 Jul 2012 16:46:25 +0000 (+0200) Subject: do not pass incorrect length to remember_include_file() X-Git-Tag: v3.2~128 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=51f79b9de8cea1fc34b40da2294874e48355af93;p=thirdparty%2Fccache.git do not pass incorrect length to remember_include_file() --- diff --git a/ccache.c b/ccache.c index 926d6b2ee..0cc1a3cd2 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;