From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZPYLg-0004Zd-Rk for mharc-grub-devel@gnu.org; Wed, 12 Aug 2015 11:53:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPYLe-0004XR-L0 for grub-devel@gnu.org; Wed, 12 Aug 2015 11:53:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPYLZ-0007TV-D9 for grub-devel@gnu.org; Wed, 12 Aug 2015 11:53:50 -0400 Received: from complete.lackof.org ([198.49.126.79]:46821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPYLZ-0007SP-7w for grub-devel@gnu.org; Wed, 12 Aug 2015 11:53:45 -0400 Received: from localhost (c-107-2-141-92.hsd1.co.comcast.net [107.2.141.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by complete.lackof.org (Postfix) with ESMTPSA id 60AE533E002A for ; Wed, 12 Aug 2015 09:53:42 -0600 (MDT) From: dann frazier To: grub-devel@gnu.org Subject: [PATCH] progress: Check for NULL filename Date: Wed, 12 Aug 2015 09:53:25 -0600 Message-Id: <1439394805-8573-1-git-send-email-dann.frazier@canonical.com> X-Mailer: git-send-email 2.5.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 198.49.126.79 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Aug 2015 15:53:51 -0000 Avoid a NULL pointer dereference if the upper fs layer hasn't set the file->name field. Files opened through the grub_net_fs interface currently do not have this field set (though perhaps they should?). Signed-off-by: dann frazier --- grub-core/lib/progress.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/grub-core/lib/progress.c b/grub-core/lib/progress.c index 63a0767..2775554 100644 --- a/grub-core/lib/progress.c +++ b/grub-core/lib/progress.c @@ -70,8 +70,7 @@ grub_file_progress_hook_real (grub_disk_addr_t sector __attribute__ ((unused)), percent = grub_divmod64 (100 * file->progress_offset, file->size, 0); - partial_file_name = grub_strrchr (file->name, '/'); - if (partial_file_name) + if (file->name && (partial_file_name = grub_strrchr (file->name, '/'))) partial_file_name++; else partial_file_name = ""; -- 2.5.0