summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvik/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/xdvik/main.c')
-rw-r--r--Build/source/texk/xdvik/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Build/source/texk/xdvik/main.c b/Build/source/texk/xdvik/main.c
index 11814e7633a..407c2af4eeb 100644
--- a/Build/source/texk/xdvik/main.c
+++ b/Build/source/texk/xdvik/main.c
@@ -455,7 +455,10 @@ is_good_dvi_file(const char *filename, Boolean from_history)
if ((ret = REALPATH(real_filename, canonical_path)) == NULL) {
/* REALPATH failed, use real_filename */
- size_t n = strnlen(real_filename, MAXPATHLEN);
+ size_t n = strlen(real_filename);
+ if (n >= MAXPATHLEN) {
+ n = MAXPATHLEN;
+ }
memcpy(canonical_path, real_filename, n);
canonical_path[n] = '\0';