Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LsZWQ-00058C-Px for mharc-grub-devel@gnu.org; Sat, 11 Apr 2009 05:29:10 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LsZWO-00056t-Qq for grub-devel@gnu.org; Sat, 11 Apr 2009 05:29:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LsZWJ-00051Y-Jz for grub-devel@gnu.org; Sat, 11 Apr 2009 05:29:07 -0400 Received: from [199.232.76.173] (port=60367 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LsZWJ-00051K-6E for grub-devel@gnu.org; Sat, 11 Apr 2009 05:29:03 -0400 Received: from ti-out-0910.google.com ([209.85.142.189]:49343) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LsZWI-0000o0-O6 for grub-devel@gnu.org; Sat, 11 Apr 2009 05:29:03 -0400 Received: by ti-out-0910.google.com with SMTP id y8so994023tia.10 for ; Sat, 11 Apr 2009 02:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=+N8awkh8QJbH/74DLH1g21lzrol9GK9wSY4iZl4PdRc=; b=ozPZuzBbl8HitMDPdz3fz4dusAlZQveWEEFETkj3sJEo1uvQTcVBK9FU8c0odH4kRH ioCTKLDz3xl/ia0ijwrNQhO09NgHFe4vnHuaWfSmq7Gap/4NDPXAtKcyYY10Habfcdnt i/4z+QT8VVLu1BoNheucpu246qAb2ZdRRmXwg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=Vjvnw/PD6EaF2lQVGuoo7UDC1GPQHlq9sCcOTmrDUC4BD/PJFFd3L5E2NBi6iDQ2// wrIkdQwobSoVWylZGw3jo0cXKlVP8MdvoAYLQvttvFyuNtq2TSUWuqWksd2owGnZTeOy 1rH6AXS5Eo9XtbKLiRivHZ4eaZ57khNzF/bnw= MIME-Version: 1.0 Received: by 10.110.40.8 with SMTP id n8mr6109423tin.28.1239442140866; Sat, 11 Apr 2009 02:29:00 -0700 (PDT) Date: Sat, 11 Apr 2009 17:29:00 +0800 Message-ID: From: Bean To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [PATCH] bug fix for grub-pe2elf X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2009 09:29:09 -0000 Hi, When symbol name is 8 or less, pe store it as short name, which is not necessary null-terminated. This patch take that into account and append a null character at the end. diff --git a/util/grub-pe2elf.c b/util/grub-pe2elf.c index d703d33..a2504d2 100644 --- a/util/grub-pe2elf.c +++ b/util/grub-pe2elf.c @@ -344,10 +344,17 @@ write_symbol_table (FILE* fp, char *image, } else { + char short_name[9]; char *name; - name = ((pe_symtab->long_name[0]) ? pe_symtab->short_name : - pe_strtab + pe_symtab->long_name[1]); + if (pe_symtab->long_name[0]) + { + strncpy (short_name, pe_symtab->short_name, 8); + short_name[8] = 0; + name = short_name; + } + else + name = pe_strtab + pe_symtab->long_name[1]; if ((strcmp (name, "_grub_mod_init")) && (strcmp (name, "_grub_mod_fini")) && -- Bean