]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2007-05-17 Jeroen Dekkers <jeroen@dekkers.cx>
authorjeroen <jeroen@localhost>
Thu, 17 May 2007 19:03:42 +0000 (19:03 +0000)
committerjeroen <jeroen@localhost>
Thu, 17 May 2007 19:03:42 +0000 (19:03 +0000)
* util/biosdisk.c (linux_find_partition): Allocate real_dev on the
stack instead of on the heap.

* kern/disk.c (grub_disk_read): Make sure tmp_buf is big enough
before doing a read on it.

* configure.ac: Only use -fno-stack-protector for the target
environment.

ChangeLog
configure
configure.ac
kern/disk.c
util/biosdisk.c

index 57f5856b62cf01c46af83581f237076714a0a081..63f58985edaca34b45a0794a5b44be13dff14be8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-05-17  Jeroen Dekkers  <jeroen@dekkers.cx>
+
+       * util/biosdisk.c (linux_find_partition): Allocate real_dev on the
+       stack instead of on the heap.
+
+       * kern/disk.c (grub_disk_read): Make sure tmp_buf is big enough
+       before doing a read on it.
+
+       * configure.ac: Only use -fno-stack-protector for the target
+       environment.
+       
 2007-05-17  Jeroen Dekkers  <jeroen@dekkers.cx>
 
        * video/i386/pc/vbe.c (grub_video_vbe_create_render_target): Add
index e386b1d380d6c863b3679a0f3beb926cdfa9920d..29a6e045905253660a8a115a7761de4ab1fe4416 100644 (file)
--- a/configure
+++ b/configure
@@ -5784,40 +5784,6 @@ fi
 done
 
 
-#
-# Compiler features.
-#
-
-# Smashing stack protector.
-
-# Smashing stack protector.
-ssp_possible=yes
-{ echo "$as_me:$LINENO: checking whether \`$CC' accepts \`-fstack-protector'" >&5
-echo $ECHO_N "checking whether \`$CC' accepts \`-fstack-protector'... $ECHO_C" >&6; }
-# Is this a reliable test case?
-cat >conftest.$ac_ext <<_ACEOF
-void foo (void) { volatile char a[8]; a[3]; }
-_ACEOF
-# `$CC -c -o ...' might not be portable.  But, oh, well...  Is calling
-# `ac_compile' like this correct, after all?
-if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-  # Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
-  rm -f conftest.s
-else
-  ssp_possible=no
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-# Need that, because some distributions ship compilers that include
-# `-fstack-protector' in the default specs.
-if [ x"$ssp_possible" = xyes ]; then
-  CFLAGS=$CFLAGS\ -fno-stack-protector
-fi
-
-
 #
 # Check for target programs.
 #
index df056f4bf5710143d297342d92b4306e414a7e7d..572250bba66081f1548adbde8cb66256273d6c98 100644 (file)
@@ -1,6 +1,6 @@
 # Process this file with autoconf to produce a configure script.
 
-# Copyright (C) 2002,2003,2004,2005,2006  Free Software Foundation, Inc.
+# Copyright (C) 2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.
 #
 # This configure.ac is free software; the author
 # gives unlimited permission to copy and/or distribute it,
@@ -151,19 +151,6 @@ fi
 # Check for functions.
 AC_CHECK_FUNCS(posix_memalign memalign)
 
-#
-# Compiler features.
-#
-
-# Smashing stack protector.
-grub_CHECK_STACK_PROTECTOR
-[# Need that, because some distributions ship compilers that include
-# `-fstack-protector' in the default specs.
-if [ x"$ssp_possible" = xyes ]; then
-  CFLAGS=$CFLAGS\ -fno-stack-protector
-fi]
-
-
 #
 # Check for target programs.
 #
index 33875d43064246e82ee84c803f475684cffb96c0..4ac123f927f5e76c5d79a797da375e5120b8af0c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003,2004,2006  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2003,2004,2006,2007  Free Software Foundation, Inc.
  *
  *  GRUB is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -414,6 +414,8 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
 
              num = ((size + GRUB_DISK_SECTOR_SIZE - 1)
                     >> GRUB_DISK_SECTOR_BITS);
+
+             tmp_buf = grub_realloc (tmp_buf, num << GRUB_DISK_SECTOR_BITS);
              if ((disk->dev->read) (disk, sector, num, tmp_buf))
                {
                  grub_error_push ();
index 6e3aed407e65e67568cf1eabc4daa3057a4b9714..c20d4e1cc8b088b47ddf70656500e7f66422e5d7 100644 (file)
@@ -214,9 +214,9 @@ linux_find_partition (char *dev, unsigned long sector)
   const char *format;
   char *p;
   int i;
-  char *real_dev;
+  char real_dev[PATH_MAX];
 
-  real_dev = xstrdup (dev);
+  strcpy(real_dev, dev);
   
   if (have_devfs () && strcmp (real_dev + len - 5, "/disc") == 0)
     {
@@ -234,10 +234,7 @@ linux_find_partition (char *dev, unsigned long sector)
     {
       p = strchr (real_dev + 9, 'd');
       if (! p)
-       {
-         free (real_dev);
-         return 0;
-       }
+       return 0;
 
       p++;
       while (*p && isdigit (*p))
@@ -246,10 +243,7 @@ linux_find_partition (char *dev, unsigned long sector)
       format = "p%d";
     }
   else
-    {
-      free (real_dev);
-      return 0;
-    }
+    return 0;
 
   for (i = 1; i < 10000; i++)
     {
@@ -259,15 +253,11 @@ linux_find_partition (char *dev, unsigned long sector)
       sprintf (p, format, i);
       fd = open (real_dev, O_RDONLY);
       if (! fd)
-       {
-         free (real_dev);
-         return 0;
-       }
+       return 0;
 
       if (ioctl (fd, HDIO_GETGEO, &hdg))
        {
          close (fd);
-         free (real_dev);
          return 0;
        }
 
@@ -276,12 +266,10 @@ linux_find_partition (char *dev, unsigned long sector)
       if (hdg.start == sector)
        {
          strcpy (dev, real_dev);
-         free (real_dev);
          return 1;
        }
     }
 
-  free (real_dev);
   return 0;
 }
 #endif /* __linux__ */