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