NetBSD Problem Report #53022

From www@NetBSD.org  Tue Feb 13 01:06:03 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 612E07A166
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 13 Feb 2018 01:06:03 +0000 (UTC)
Message-Id: <20180213010602.701EF7A1F7@mollari.NetBSD.org>
Date: Tue, 13 Feb 2018 01:06:02 +0000 (UTC)
From: venture37@geeklan.co.uk
Reply-To: venture37@geeklan.co.uk
To: gnats-bugs@NetBSD.org
Subject: gpt(8) segfaults if invoked without device specified
X-Send-Pr-Version: www-1.0

>Number:         53022
>Category:       bin
>Synopsis:       gpt(8) segfaults if invoked without device specified
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 13 01:10:00 +0000 2018
>Closed-Date:    Wed Mar 21 00:19:58 +0000 2018
>Last-Modified:  Wed Mar 21 00:19:58 +0000 2018
>Originator:     Sevan Janiyan
>Release:        NetBSD-HEAD
>Organization:
>Environment:
>Description:
gpt(8) assumes the device has been passed when invoked & attempts to enumerated the device in src/sbin/gpt/main.c, then ploughs forward.
As a work around I've added a check in each cmd_$command() 
if (gpt == NULL)
   return usage();
which works and has the benefit of returning the relevant usage for the sub command being invoked. On the other hand, I haven't worked out how to hand things in main() to stop right at the start so I only have to deal with the issue in one place.
>How-To-Repeat:
run gpart show -a
>Fix:

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: sevan@NetBSD.org
State-Changed-When: Wed, 21 Mar 2018 00:19:58 +0000
State-Changed-Why:
Issue being investigated in PR bin/53107


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.