fix problem with filename parsing if file does not have extension but also has a . in the path (SF#1161916 http://sourceforge.net/tracker/index.php?func=detail&aid=1161916&group_id=13478&atid=113478)

This commit is contained in:
Josh Coalson
2006-11-10 17:42:55 +00:00
parent cc190e8362
commit b413ea41c7

View File

@@ -1905,7 +1905,8 @@ const char *get_outfilename(const char *infilename, const char *suffix)
return 0;
if (flac__strlcat(buffer, infilename, sizeof buffer) >= sizeof buffer)
return 0;
if(0 == (p = strrchr(buffer, '.'))) {
/* the . must come after any / to avoid problems with, e.g. "some.directory/extensionless-filename" */
if(0 == (p = strrchr(buffer, '.')) || strchr(p, '/')) {
if (flac__strlcat(buffer, suffix, sizeof buffer) >= sizeof buffer)
return 0;
}