]> git.pld-linux.org Git - packages/gdb.git/blobdiff - gdb-6.3-security-errata-20050610.patch
- updated (performance fixes).
[packages/gdb.git] / gdb-6.3-security-errata-20050610.patch
index 1092c3123e20d0f238db1feadda0dc655e002900..8e048d8d2f1aec54853efe4b853624961b9a7a5e 100644 (file)
@@ -19,29 +19,29 @@ Proposed upstream but never committed upstream.
         (source_command): Update documentation.  Check permissions if
         FROM_TTY is -1.
 
-Index: gdb-6.8.50.20090226/gdb/cli/cli-cmds.c
+Index: gdb-7.4.50.20111218/gdb/cli/cli-cmds.c
 ===================================================================
---- gdb-6.8.50.20090226.orig/gdb/cli/cli-cmds.c        2009-02-27 00:04:32.000000000 +0100
-+++ gdb-6.8.50.20090226/gdb/cli/cli-cmds.c     2009-02-28 07:17:49.000000000 +0100
-@@ -36,6 +36,7 @@
- #include "objfiles.h"
+--- gdb-7.4.50.20111218.orig/gdb/cli/cli-cmds.c        2011-12-16 22:17:42.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/cli/cli-cmds.c     2011-12-19 00:27:16.572468926 +0100
+@@ -40,6 +40,7 @@
  #include "source.h"
  #include "disasm.h"
+ #include "tracepoint.h"
 +#include "gdb_stat.h"
  
  #include "ui-out.h"
  
-@@ -466,7 +467,7 @@ source_script (char *file, int from_tty)
+@@ -485,7 +486,7 @@ show_script_ext_mode (struct ui_file *fi
  
-   if (fd == -1)
-     {
--      if (from_tty)
-+      if (from_tty > 0)
-       perror_with_name (file);
-       else
-       {
-@@ -475,6 +476,29 @@ source_script (char *file, int from_tty)
-       }
+ int
+ find_and_open_script (const char *script_file, int search_path,
+-                    FILE **streamp, char **full_pathp)
++                    FILE **streamp, char **full_pathp, int from_tty)
+ {
+   char *file;
+   int fd;
+@@ -511,6 +512,32 @@ find_and_open_script (const char *script
+       return 0;
      }
  
 +#ifdef HAVE_GETUID
@@ -51,10 +51,12 @@ Index: gdb-6.8.50.20090226/gdb/cli/cli-cmds.c
 +
 +      if (fstat (fd, &statbuf) < 0)
 +      {
++        int save_errno = errno;
++
 +        close (fd);
-+        /* Do not do_cleanups (old_cleanups) as FILE is allocated there.
-+           perror_with_name calls error which should call the cleanups.  */
-+        perror_with_name (file);
++        do_cleanups (old_cleanups);
++        errno = save_errno;
++        return 0;
 +      }
 +      if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH))
 +      {
@@ -62,27 +64,37 @@ Index: gdb-6.8.50.20090226/gdb/cli/cli-cmds.c
 +        warning (_("not using untrusted file \"%s\""), file);
 +        close (fd);
 +        do_cleanups (old_cleanups);
-+        return;
++        errno = EPERM;
++        return 0;
 +      }
 +    }
 +#endif
 +
-   is_python = source_python;
-   if (strlen (file) > 3 && !strcmp (&file[strlen (file) - 3], ".py"))
-     is_python = 1;
-@@ -486,6 +510,7 @@ source_script (char *file, int from_tty)
-   else
-     script_from_file (stream, file);
-+  /* FILE gets freed by do_cleanups (old_cleanups).  */
    do_cleanups (old_cleanups);
- }
  
-Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.exp
+   *streamp = fdopen (fd, FOPEN_RT);
+@@ -572,13 +599,14 @@ source_script_with_search (const char *f
+   if (file == NULL || *file == 0)
+     error (_("source command requires file name of file to source."));
+-  if (!find_and_open_script (file, search_path, &stream, &full_path))
++  if (!find_and_open_script (file, search_path, &stream, &full_path,
++                           from_tty))
+     {
+       /* The script wasn't found, or was otherwise inaccessible.
+          If the source command was invoked interactively, throw an
+        error.  Otherwise (e.g. if it was invoked by a script),
+        silently ignore the error.  */
+-      if (from_tty)
++      if (from_tty > 0)
+       perror_with_name (file);
+       else
+       return;
+Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.exp
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.exp     2009-02-28 07:15:57.000000000 +0100
-@@ -0,0 +1,98 @@
++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.exp     2011-12-19 00:25:26.079891954 +0100
+@@ -0,0 +1,91 @@
 +#   Copyright 2005
 +#   Free Software Foundation, Inc.
 +
@@ -105,13 +117,6 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.exp
 +
 +# This file was written by Jeff Johnston <jjohnstn@redhat.com>.
 +
-+if $tracelevel then {
-+    strace $tracelevel
-+}
-+
-+set prms_id 0
-+set bug_id 0
-+
 +# are we on a target board
 +if [is_remote target] {
 +    return
@@ -181,17 +186,17 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.exp
 +}
 +
 +remote_exec build "rm .gdbinit"
-Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.sample
+Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.sample
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.sample  2009-02-28 07:15:57.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.sample  2011-12-19 00:25:26.079891954 +0100
 @@ -0,0 +1 @@
 +echo "\nin gdbinit"
-Index: gdb-6.8.50.20090226/gdb/main.c
+Index: gdb-7.4.50.20111218/gdb/main.c
 ===================================================================
---- gdb-6.8.50.20090226.orig/gdb/main.c        2009-02-27 00:04:32.000000000 +0100
-+++ gdb-6.8.50.20090226/gdb/main.c     2009-02-28 07:15:57.000000000 +0100
-@@ -855,7 +855,7 @@ Excess command line arguments ignored. (
+--- gdb-7.4.50.20111218.orig/gdb/main.c        2011-11-05 18:08:30.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/main.c     2011-12-19 00:25:26.080891950 +0100
+@@ -822,7 +822,7 @@ captured_main (void *data)
       debugging or what directory you are in.  */
  
    if (home_gdbinit && !inhibit_gdbinit)
@@ -200,12 +205,39 @@ Index: gdb-6.8.50.20090226/gdb/main.c
  
    /* Now perform all the actions indicated by the arguments.  */
    if (cdarg != NULL)
-@@ -924,7 +924,7 @@ Can't attach to process and specify a co
+@@ -901,7 +901,7 @@ captured_main (void *data)
    /* Read the .gdbinit file in the current directory, *if* it isn't
       the same as the $HOME/.gdbinit file (it should exist, also).  */
    if (local_gdbinit && !inhibit_gdbinit)
 -    catch_command_errors (source_script, local_gdbinit, 0, RETURN_MASK_ALL);
 +    catch_command_errors (source_script, local_gdbinit, -1, RETURN_MASK_ALL);
  
-   for (i = 0; i < ncmd; i++)
-     {
+   /* Now that all .gdbinit's have been read and all -d options have been
+      processed, we can read any scripts mentioned in SYMARG.
+Index: gdb-7.4.50.20111218/gdb/python/py-auto-load.c
+===================================================================
+--- gdb-7.4.50.20111218.orig/gdb/python/py-auto-load.c 2011-12-10 23:51:47.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/python/py-auto-load.c      2011-12-19 00:25:26.080891950 +0100
+@@ -284,7 +284,7 @@ source_section_scripts (struct objfile *
+       }
+       opened = find_and_open_script (file, 1 /*search_path*/,
+-                                   &stream, &full_path);
++                                   &stream, &full_path, 1 /* from_tty */);
+       /* If one script isn't found it's not uncommon for more to not be
+        found either.  We don't want to print an error message for each
+Index: gdb-7.4.50.20111218/gdb/cli/cli-cmds.h
+===================================================================
+--- gdb-7.4.50.20111218.orig/gdb/cli/cli-cmds.h        2011-11-01 15:51:23.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/cli/cli-cmds.h     2011-12-19 00:25:26.080891950 +0100
+@@ -129,7 +129,8 @@ extern void source_script (char *, int);
+ /* Exported to objfiles.c.  */
+ extern int find_and_open_script (const char *file, int search_path,
+-                               FILE **streamp, char **full_path);
++                               FILE **streamp, char **full_path,
++                               int from_tty);
+ /* Command tracing state.  */
This page took 0.071948 seconds and 4 git commands to generate.