texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * info/dir.c (dir_entry_of_infodir): Always alloc


From: Gavin D. Smith
Subject: branch master updated: * info/dir.c (dir_entry_of_infodir): Always allocate enough memory in argument to info_check_compressed. Crash with hardened_malloc for "info -a arg" reported by Tommy Nguyen.
Date: Sat, 24 Sep 2022 08:46:25 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 436f54d58a * info/dir.c (dir_entry_of_infodir): Always allocate enough 
memory in argument to info_check_compressed.  Crash with hardened_malloc for 
"info -a arg" reported by Tommy Nguyen.
436f54d58a is described below

commit 436f54d58a6b0ae2248e2d616b5c89db9fe1d6b8
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Sep 24 13:46:16 2022 +0100

    * info/dir.c (dir_entry_of_infodir): Always allocate enough
    memory in argument to info_check_compressed.  Crash with
    hardened_malloc for "info -a arg" reported by Tommy Nguyen.
---
 ChangeLog  |  6 ++++++
 info/dir.c | 12 ++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ca962e6093..94cf4e06f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-09-24  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       * info/dir.c (dir_entry_of_infodir): Always allocate enough
+       memory in argument to info_check_compressed.  Crash with
+       hardened_malloc for "info -a arg" reported by Tommy Nguyen.
+
 2022-09-24  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * README-hacking: git branch structure for after next release
diff --git a/info/dir.c b/info/dir.c
index eaa2c405d0..7eb5e80ef2 100644
--- a/info/dir.c
+++ b/info/dir.c
@@ -248,16 +248,12 @@ dir_entry_of_infodir (char *label, char *searchdir)
   NODE *dir_node;
   REFERENCE *entry;
 
-  len = xasprintf (&dir_fullpath, "%s/dir%s", searchdir, PADDING);
+  if (IS_ABSOLUTE(searchdir))
+    len = xasprintf (&dir_fullpath, "%s/dir%s", searchdir, PADDING);
+  else
+    len = xasprintf (&dir_fullpath, "./%s/dir%s", searchdir, PADDING);
   dir_fullpath[len - strlen(PADDING)] = '\0';
 
-  if (!IS_ABSOLUTE(dir_fullpath))
-    {
-      char *tmp;
-      xasprintf (&tmp, "./%s", dir_fullpath);
-      free (dir_fullpath);
-      dir_fullpath = tmp;
-    }
   result = info_check_compressed (dir_fullpath, &dummy);
   if (!result)
     {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]