summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-02-17 07:57:37 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-02-17 07:57:37 +0000
commit0fd05d35d9207f339833f00639d53e9a8c0b506a (patch)
tree6ce91196424cd2492a13252def3316f05a65cabe
parentb2e987d05fc3851efeced0cff4576c84c0e96f7c (diff)
texk/devnag: Bug fix from Richard Koch <koch@math.uoregon.edu>
git-svn-id: svn://tug.org/texlive/trunk@32989 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/devnag/ChangeLog6
-rw-r--r--Build/source/texk/devnag/src/devnag.c11
2 files changed, 11 insertions, 6 deletions
diff --git a/Build/source/texk/devnag/ChangeLog b/Build/source/texk/devnag/ChangeLog
index 965a42b8710..07336c9eb2f 100644
--- a/Build/source/texk/devnag/ChangeLog
+++ b/Build/source/texk/devnag/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-17 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * src/devnag.c (dnproc): Bug fix: Replace strcpy() by memmove()
+ when src and dest overlap.
+ Reported by Richard Koch <koch@math.uoregon.edu>.
+
2013-10-01 Peter Breitenlohner <peb@mppmu.mpg.de>
* configure.ac: Drop AC_HEADER_STDC, fail for missing strstr().
diff --git a/Build/source/texk/devnag/src/devnag.c b/Build/source/texk/devnag/src/devnag.c
index bc95c182472..4e48d7ab248 100644
--- a/Build/source/texk/devnag/src/devnag.c
+++ b/Build/source/texk/devnag/src/devnag.c
@@ -1656,8 +1656,7 @@ void dnproc(void) {
wrong[2] = '\0';
err_ill(wrong);
}
- else
- if (i == 5) put_ch(47);
+ else if (i == 5) put_ch(47);
else put_ch((short)(i+20));
break;
case end_of_line:
@@ -1670,7 +1669,7 @@ void dnproc(void) {
else put_ch('}');
dnready = TRUE;
put_word();
- strcpy(inbuf, &inbuf[buf_idx]);
+ memmove(inbuf, inbuf+buf_idx, strlen(inbuf+buf_idx)+1);
}
break;
case '}':
@@ -1680,7 +1679,7 @@ void dnproc(void) {
else put_ch(symbol);
dnready = TRUE;
put_word();
- strcpy(inbuf, &inbuf[buf_idx]);
+ memmove(inbuf, inbuf+buf_idx, strlen(inbuf+buf_idx)+1);
}
else put_ch(symbol);
break;
@@ -1698,7 +1697,7 @@ void dnproc(void) {
sendchar('\n');
break;
case '<':
- put_syll();
+ put_syll();
do {
symbol = inp_ch();
if (symbol == end_of_line) symbol = '\n';
@@ -1794,7 +1793,7 @@ void dnproc(void) {
fputs("Error: missing }", stderr);
exit(1);
default:
- if (symbol < 0) err_ill('\0'); /* accented character inside dn mode */
+ if (symbol < 0) err_ill('\0'); /* accented character inside dn mode */
i = 0;
do { i++; } while ((i != 10) && (chset4[i-1] != symbol));
if (i == 10) put_ch(symbol);