desktop.cc: In function 'void start_menu(const string&, const string&, const string&, const string&)': desktop.cc:110:11: error: 'char* strncat(char*, const char*, size_t)' specified bound 260 equals destination size [-Werror=stringop-overflow=]
I think strlcat() was meant here, which MinGW doesn't have. In it's absence, open-code it's equivalent. (SHGetSpecialFolderLocation() returns a pathname of length at most MAX_PATH, and make_link() is limited to accepting a pathname of length MAX_PATH, so we want to append our folder name, while truncating the result to MAX_PATH.) --- desktop.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop.cc b/desktop.cc index 927c02f..d003e91 100644 --- a/desktop.cc +++ b/desktop.cc @@ -107,7 +107,8 @@ start_menu (const std::string& title, const std::string& target, issystem ? CSIDL_COMMON_PROGRAMS : CSIDL_PROGRAMS, &id); SHGetPathFromIDList (id, path); - strncat (path, "/Cygwin", MAX_PATH); + strncat (path, "/Cygwin", MAX_PATH - strlen(path)); + path[MAX_PATH-1] = 0; LogBabblePrintf ("Program directory for program link: %s", path); make_link (path, title, target, arg, iconpath); } -- 2.17.0