summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2010-05-20 14:34:14 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2010-05-20 14:34:14 +0000
commitbc8d737aa526c37776b6fe866e71064bccaaf435 (patch)
tree13ea21b0209105b59cec0ad0cc0f051a3c71d00b /Build
parent7afe33c9e8991dd299d8099fdac56d6220748b60 (diff)
fix chktex bug
git-svn-id: svn://tug.org/texlive/trunk@18377 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/utils/chktex/chktex-1.6.4-PATCHES/ChangeLog6
-rw-r--r--Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-04-strcpy-bug35
-rw-r--r--Build/source/utils/chktex/chktex-1.6.4/FindErrs.c7
3 files changed, 45 insertions, 3 deletions
diff --git a/Build/source/utils/chktex/chktex-1.6.4-PATCHES/ChangeLog b/Build/source/utils/chktex/chktex-1.6.4-PATCHES/ChangeLog
index b8600569172..1e921b92a5c 100644
--- a/Build/source/utils/chktex/chktex-1.6.4-PATCHES/ChangeLog
+++ b/Build/source/utils/chktex/chktex-1.6.4-PATCHES/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-20 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-04-strcpy-bug (new): Bug fixes:
+ (GetLTXArg): Avoid strcpy() with overlapping args.
+ (PreProcess): Do not access Buf[-1].
+
2010-05-06 Peter Breitenlohner <peb@mppmu.mpg.de>
* patch-02-bug (new): Bug fix
diff --git a/Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-04-strcpy-bug b/Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-04-strcpy-bug
new file mode 100644
index 00000000000..ed744e02d4f
--- /dev/null
+++ b/Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-04-strcpy-bug
@@ -0,0 +1,35 @@
+ Must not use strcpy() for overlapping strings.
+
+ Do not access Buf[-1].
+
+diff -ur chktex-1.6.4.orig/FindErrs.c chktex-1.6.4/FindErrs.c
+--- chktex-1.6.4.orig/FindErrs.c 2010-05-02 22:12:06.000000000 +0200
++++ chktex-1.6.4/FindErrs.c 2010-05-20 16:28:35.822091392 +0200
+@@ -218,7 +218,7 @@
+
+ if (Retval && (*OrigDest == '{') && (Until == GET_STRIP_TOKEN))
+ {
+- strcpy(OrigDest, OrigDest + 1);
++ memmove(OrigDest, OrigDest + 1, strlen(OrigDest));
+ OrigDest[strlen(OrigDest) - 1] = 0;
+ }
+ break;
+@@ -266,7 +266,7 @@
+
+ while ((TmpPtr = strchr(TmpPtr, '%')))
+ {
+- if (TmpPtr[-1] != '\\')
++ if ((TmpPtr == Buf) || (TmpPtr[-1] != '\\'))
+ {
+ PSERR(TmpPtr - Buf, 1, emComment);
+ *TmpPtr = 0;
+@@ -1317,7 +1317,8 @@
+ * %n - warning Number
+ * %u - an Underlining line (like the one which appears when using -v1)
+ * %r - part of line in front of error ('S' - 1)
+- * %s - part of line which contains error (String) * %t - part of line after error ('S' + 1)
++ * %s - part of line which contains error (String)
++ * %t - part of line after error ('S' + 1)
+ */
+
+
diff --git a/Build/source/utils/chktex/chktex-1.6.4/FindErrs.c b/Build/source/utils/chktex/chktex-1.6.4/FindErrs.c
index 5f44a16390d..933bd4567e3 100644
--- a/Build/source/utils/chktex/chktex-1.6.4/FindErrs.c
+++ b/Build/source/utils/chktex/chktex-1.6.4/FindErrs.c
@@ -218,7 +218,7 @@ static char *GetLTXArg(char *SrcBuf, char *OrigDest, const int Until,
if (Retval && (*OrigDest == '{') && (Until == GET_STRIP_TOKEN))
{
- strcpy(OrigDest, OrigDest + 1);
+ memmove(OrigDest, OrigDest + 1, strlen(OrigDest));
OrigDest[strlen(OrigDest) - 1] = 0;
}
break;
@@ -266,7 +266,7 @@ static char *PreProcess(void)
while ((TmpPtr = strchr(TmpPtr, '%')))
{
- if (TmpPtr[-1] != '\\')
+ if ((TmpPtr == Buf) || (TmpPtr[-1] != '\\'))
{
PSERR(TmpPtr - Buf, 1, emComment);
*TmpPtr = 0;
@@ -1317,7 +1317,8 @@ void PrintStatus(unsigned long Lines)
* %n - warning Number
* %u - an Underlining line (like the one which appears when using -v1)
* %r - part of line in front of error ('S' - 1)
- * %s - part of line which contains error (String) * %t - part of line after error ('S' + 1)
+ * %s - part of line which contains error (String)
+ * %t - part of line after error ('S' + 1)
*/