texinfo/texinfo-6.4-info-fix-possible-incorrect-selection-of-already-loaded-file.patch
2017-07-10 10:54:48 +02:00

23 lines
1.0 KiB
Diff

diff -up texinfo-6.4/info/nodes.c.orig texinfo-6.4/info/nodes.c
--- texinfo-6.4/info/nodes.c.orig 2017-06-18 14:50:42.000000000 +0200
+++ texinfo-6.4/info/nodes.c 2017-07-10 09:39:10.195209219 +0200
@@ -678,6 +678,7 @@ info_find_subfile (char *fullpath)
char *with_extension = 0;
int i;
FILE_BUFFER *file_buffer = 0;
+ int fullpath_len = strlen (fullpath);
/* First try to find the file in our list of already loaded files. */
if (info_loaded_files)
@@ -685,7 +686,9 @@ info_find_subfile (char *fullpath)
for (i = 0; (file_buffer = info_loaded_files[i]); i++)
/* Check if fullpath starts the name of the recorded file (extra
extensions like ".info.gz" could be added.) */
- if (!strncmp (file_buffer->fullpath, fullpath, strlen (fullpath)))
+ if (!strncmp (file_buffer->fullpath, fullpath, fullpath_len)
+ && (file_buffer->fullpath[fullpath_len] == '\0'
+ || file_buffer->fullpath[fullpath_len] == '.'))
{
struct stat new_info, *old_info;