+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
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.
#
# 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,
# 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.
#
/*
* 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
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 ();
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)
{
{
p = strchr (real_dev + 9, 'd');
if (! p)
- {
- free (real_dev);
- return 0;
- }
+ return 0;
p++;
while (*p && isdigit (*p))
format = "p%d";
}
else
- {
- free (real_dev);
- return 0;
- }
+ return 0;
for (i = 1; i < 10000; i++)
{
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;
}
if (hdg.start == sector)
{
strcpy (dev, real_dev);
- free (real_dev);
return 1;
}
}
- free (real_dev);
return 0;
}
#endif /* __linux__ */