summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/web2c/synctexdir/ChangeLog4
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_main.c13
2 files changed, 11 insertions, 6 deletions
diff --git a/Build/source/texk/web2c/synctexdir/ChangeLog b/Build/source/texk/web2c/synctexdir/ChangeLog
index eb18a8ae5a2..c169e25fcda 100644
--- a/Build/source/texk/web2c/synctexdir/ChangeLog
+++ b/Build/source/texk/web2c/synctexdir/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-14 Sebastian Ramacher <sramacher@debian.org>
+
+ * synctex_main.c: Bug fix (segfault).
+
2013-02-11 Peter Breitenlohner <peb@mppmu.mpg.de>
Simplify SyncTeX change files.
diff --git a/Build/source/texk/web2c/synctexdir/synctex_main.c b/Build/source/texk/web2c/synctexdir/synctex_main.c
index 5274cda455c..f0fa3b96dab 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_main.c
+++ b/Build/source/texk/web2c/synctexdir/synctex_main.c
@@ -304,11 +304,11 @@ scan_output:
if(++arg_index<argc) {
goto option_command;
} else {
- synctex_view_proceed(&Ps);
+ return synctex_view_proceed(&Ps);
}
} else {
Ps.directory = getenv("SYNCTEX_BUILD_DIRECTORY");
- synctex_view_proceed(&Ps);
+ return synctex_view_proceed(&Ps);
}
}
option_command:
@@ -320,7 +320,7 @@ option_command:
if(++arg_index<argc) {
goto option_hint;
} else {
- synctex_view_proceed(&Ps);
+ return synctex_view_proceed(&Ps);
}
} else {
/* retrieve the environment variable */
@@ -329,7 +329,7 @@ option_command:
}
} else {
Ps.viewer = getenv("SYNCTEX_VIEWER");
- synctex_view_proceed(&Ps);
+ return synctex_view_proceed(&Ps);
}
}
option_hint:
@@ -347,7 +347,7 @@ option_hint:
*Ps.after = '\0';
if(Ps.offset<strlen(Ps.middle)) {
++Ps.after;
- synctex_view_proceed(&Ps);
+ return synctex_view_proceed(&Ps);
}
}
}
@@ -460,11 +460,12 @@ int synctex_view_proceed(synctex_view_params_t * Ps) {
break;
}
/* copy the rest of viewer into the buffer */
- if(buffer_cur != memcpy(buffer_cur,viewer,strlen(viewer))) {
+ if(buffer_cur != strncpy(buffer_cur,viewer,size + 1)) {
synctex_help_view("Memory copy problem");
free(buffer);
return -1;
}
+ buffer_cur[size] = '\0';
printf("SyncTeX: Executing\n%s\n",buffer);
status = system(buffer);
free(buffer);