bug-findutils
[Top][All Lists]
Advanced

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

[PATCH] Fix coredump bug introduced in the previous change.


From: James Youngman
Subject: [PATCH] Fix coredump bug introduced in the previous change.
Date: Tue, 14 Jun 2011 00:19:54 +0100

* locate/locate.c (dolocate): Remove declaration of e, which was
replaced by the variable db_name.  Change the last two uses of 'e'
to use 'db_name'.  This bugfix prevents possible coredumps when
issuing error messages about reads from the locate database (or
warnings about byte order for old databases).  This bug had been
introduced in the previous change.
---
 ChangeLog       |   10 ++++++++++
 locate/locate.c |    5 ++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7b2dd52..3a1ae3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-06-14  James Youngman  <address@hidden>
+
+       Fix coredump bug introduced in the previous change.
+       * locate/locate.c (dolocate): Remove declaration of e, which was
+       replaced by the variable db_name.  Change the last two uses of 'e'
+       to use 'db_name'.  This bugfix prevents possible coredumps when
+       issuing error messages about reads from the locate database (or
+       warnings about byte order for old databases).  This bug had been
+       introduced in the previous change.
+
 2011-06-13  James Youngman  <address@hidden>
 
        Split strings into fields nondestructively.
diff --git a/locate/locate.c b/locate/locate.c
index 42089ee..611b18d 100644
--- a/locate/locate.c
+++ b/locate/locate.c
@@ -1570,7 +1570,6 @@ dolocate (int argc, char **argv, int secure_db_fd)
   int regex_options = RE_SYNTAX_EMACS;
   int stats = 0;
   int op_and = 0;
-  const char *e;
   FILE *fp;
   int they_chose_db = 0;
   bool did_stdin = false;       /* Set to prevent rereading stdin. */
@@ -1785,7 +1784,7 @@ dolocate (int argc, char **argv, int secure_db_fd)
                 }
               else
                 {
-                  e = "<stdin>";
+                  db_name = "<stdin>";
                   fd = 0;
                   did_stdin = true;
                 }
@@ -1879,7 +1878,7 @@ dolocate (int argc, char **argv, int secure_db_fd)
 
       /* Search this database for all patterns simultaneously */
       found = search_one_database (argc - optind, &argv[optind],
-                                   e, fp, filesize,
+                                   db_name, fp, filesize,
                                    ignore_case, print, basename_only,
                                    use_limit, &limits, stats,
                                    op_and, regex, regex_options);
-- 
1.7.2.5




reply via email to

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