NetBSD Problem Report #55572

From ryo@tetera.org  Fri Aug 14 07:09:08 2020
Return-Path: <ryo@tetera.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 075BB1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 14 Aug 2020 07:09:07 +0000 (UTC)
Message-Id: <5f36388f.1c69fb81.af6cd.06ea@mx.google.com>
Date: Fri, 14 Aug 2020 16:08:57 +0900
From: ryo@tetera.org
Reply-To: ryoon@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: sysinst installer gets segfault when mount point is empty as input
X-Send-Pr-Version: 3.95

>Number:         55572
>Category:       install
>Synopsis:       sysinst installer gets segfault when mount point is empty as input
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 14 07:10:00 +0000 2020
>Closed-Date:    
>Last-Modified:  Fri Aug 14 08:50:01 +0000 2020
>Originator:     Ryo ONODERA
>Release:        NetBSD 9.99.70
>Organization:
Ryo ONODERA // ryo@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
>Environment:


System: NetBSD brownie 9.99.70 NetBSD 9.99.70 (GENERIC) #1: Fri Aug 14 10:18:30 JST 2020 ryoon@brownie:/usr/world/9.99/amd64/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

In sysinst installer on NetBSD/amd64 9.99.70,
if default mount point is empty, empty input (just hit enter)
causes segfault.

>How-To-Repeat:

(1) Run sysinst installer from install image or run /usr/sbin/sysinst.
(2) Select GPT partitioning.
(3) Select MSDOS (FAT) file system's mount point option (default
value is empty).
(4) Just hit enter key.
(5) Get segfault.

>Fix:

Like as follows.

Index: usr.sbin/sysinst/label.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/sysinst/label.c,v
retrieving revision 1.20
diff -u -r1.20 label.c
--- usr.sbin/sysinst/label.c	27 Jan 2020 21:21:22 -0000	1.20
+++ usr.sbin/sysinst/label.c	14 Aug 2020 06:49:06 -0000
@@ -356,6 +356,9 @@
 	if (last != NULL)
 		last[1] = 0;

+	if (first == NULL)
+		return 0;
+
 	if (*first == 0 || strcmp(first, "none") == 0) {
 		edit->wanted->mount[0] = 0;
 		edit->wanted->instflags &= ~PUIINST_MOUNT;

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: install-manager->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Fri, 14 Aug 2020 08:49:44 +0000
Responsible-Changed-Why:
my bug


State-Changed-From-To: open->needs-pullups
State-Changed-By: martin@NetBSD.org
State-Changed-When: Fri, 14 Aug 2020 08:49:44 +0000
State-Changed-Why:
fixed (similar to the suggested patch), needs pullup to -9


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55572 CVS commit: src/usr.sbin/sysinst
Date: Fri, 14 Aug 2020 08:46:54 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Fri Aug 14 08:46:54 UTC 2020

 Modified Files:
 	src/usr.sbin/sysinst: label.c

 Log Message:
 PR 55572: avoid crash when answering the mount point prompt for a previously
 empty mount point with an emptry sting.


 To generate a diff of this commit:
 cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/sysinst/label.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.