[prev in list] [next in list] [prev in thread] [next in thread]
List: gdb-patches
Subject: Fix off-by-one in add-symbol-file
From: schwab () suse ! de (Andreas Schwab)
Date: 2006-08-25 3:43:00
Message-ID: jeoduamhi7.fsf () sykes ! suse ! de
[Download RAW message or body]
We should extend sect_opts _before_ it overflows. :-)
Checked in as obvious.
Andreas.
2006-08-24 Andreas Schwab <schwab@suse.de>
* symfile.c (add_symbol_file_command): Fix off-by-one when
extending sect_opts.
--- gdb/symfile.c.~1.175.~ 2006-08-16 10:50:13.000000000 +0200
+++ gdb/symfile.c 2006-08-24 14:13:42.000000000 +0200
@@ -1853,7 +1853,7 @@ add_symbol_file_command (char *args, int
to load the program. */
sect_opts[section_index].name = ".text";
sect_opts[section_index].value = arg;
- if (++section_index > num_sect_opts)
+ if (++section_index >= num_sect_opts)
{
num_sect_opts *= 2;
sect_opts = ((struct sect_opt *)
@@ -1889,7 +1889,7 @@ add_symbol_file_command (char *args, int
{
sect_opts[section_index].value = arg;
expecting_sec_addr = 0;
- if (++section_index > num_sect_opts)
+ if (++section_index >= num_sect_opts)
{
num_sect_opts *= 2;
sect_opts = ((struct sect_opt *)
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstra??e 5, 90409 N??rnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic