rpm/rpm-4.4.2.1-strict-docdir.patch
Panu Matilainen 46c6a5d906 - avoid unnecessary .rpmsave / .rpmnew files by Tomas Mraz (#29470,
#128622)
- stricter docdir checking by Ralf S. Engelschall (#246819)
- add lua license to docs
2007-08-09 13:28:17 +00:00

27 lines
859 B
Diff

diff -r e1802883bd62 -r cf3b54441b8a build/files.c
--- a/build/files.c Sat Jul 21 15:48:03 2007 +0300
+++ b/build/files.c Mon Jul 23 10:02:54 2007 +0300
@@ -1065,7 +1065,6 @@ static int compareFileListRecs(const voi
/**
* Test if file is located in a %docdir.
- * @bug Use of strstr(3) might result in false positives.
* @param fl package file tree walk data
* @param fileName file path
* @return 1 if doc file, 0 if not
@@ -1073,9 +1072,12 @@ static int isDoc(FileList fl, const char
static int isDoc(FileList fl, const char * fileName) /*@*/
{
int x = fl->docDirCount;
-
+ size_t k, l;
+
+ k = strlen(fileName);
while (x--) {
- if (strstr(fileName, fl->docDirs[x]) == fileName)
+ l = strlen(fl->docDirs[x]);
+ if (l < k && strncmp(fileName, fl->docDirs[x], l) == 0 && fileName[l] == '/')
return 1;
}
return 0;