From owner-freebsd-hackers@FreeBSD.ORG Sat Nov 5 14:24:07 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 644AB106564A for ; Sat, 5 Nov 2011 14:24:07 +0000 (UTC) (envelope-from luke@foolishgames.com) Received: from stargazer.midnightbsd.org (cl-218.chi-02.us.sixxs.net [IPv6:2001:4978:f:d9::2]) by mx1.freebsd.org (Postfix) with ESMTP id 030738FC16 for ; Sat, 5 Nov 2011 14:24:06 +0000 (UTC) Received: from [192.168.1.107] (70-91-226-205-BusName-Michigan.hfc.comcastbusiness.net [70.91.226.205]) (authenticated bits=0) by stargazer.midnightbsd.org (8.14.5/8.14.5) with ESMTP id pA5EO43L076060 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Sat, 5 Nov 2011 10:24:05 -0400 (EDT) (envelope-from luke@foolishgames.com) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.97.3 at stargazer.midnightbsd.org X-Authentication-Warning: stargazer.midnightbsd.org: Host 70-91-226-205-BusName-Michigan.hfc.comcastbusiness.net [70.91.226.205] claimed to be [192.168.1.107] X-Habeas-Swe-2: brightly anticipated In-Reply-To: <20111105.110247.867.1@DOMY-PC> X-Habeas-Swe-7: warrant mark warrants that this is a Habeas Compliant X-Habeas-Swe-4: Copyright 2002 Habeas (tm) X-Habeas-Swe-1: winter into spring Mime-Version: 1.0 (Apple Message framework v1251.1) X-Habeas-Swe-9: mark in spam to . Date: Sat, 5 Nov 2011 10:24:04 -0400 X-Habeas-Swe-6: email in exchange for a license for this Habeas Message-Id: <1859A0FF-C3BF-4EC3-9CC6-FA97B9AF5C99@foolishgames.com> To: rank1seeker@gmail.com X-Habeas-Swe-3: like Habeas SWE (tm) Content-Transfer-Encoding: quoted-printable From: Lucas Holt References: <20111105.110247.867.1@DOMY-PC> X-Habeas-Swe-8: Message (HCM) and not spam. Please report use of this Content-Type: text/plain; charset=us-ascii X-Habeas-Swe-5: Sender Warranted Email (SWE) (tm). The sender of this X-Mailer: Apple Mail (2.1251.1) Cc: hackers@freebsd.org Subject: Re: BUG: 'glabel label' name's lenght, is truncated without err/warn X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Nov 2011 14:24:07 -0000 On Nov 5, 2011, at 7:02 AM, rank1seeker@gmail.com wrote: > 8.2R p4 both i386/amd64 >=20 >=20 > Supplied name of 16 chars > -- > # glabel label -v swap_679592d048a ada0s3b > Metadata value stored on ada0s3b. > Done. > -- >=20 > Truncated to 15 chars > -- > # ll /dev/label > total 0 > crw-r----- 1 root operator - 0, 133 Nov 5 11:41:54 2011 = swap_679592d048 > -- >=20 The maximum size for the field is 16 so that explains the behavior = you're seeing. It's strlcpy'd in. Something like the following patch = would work: --- src/sbin/geom/class/label/geom_label.c 2008/11/21 21:05:31 = 1.3 +++ src/sbin/geom/class/label/geom_label.c 2011/11/05 14:15:23 = 1.4 @@ -118,6 +118,12 @@ label_label(struct gctl_req *req) return; } =20 + label =3D gctl_get_ascii(req, "arg0"); + if (strlen(label) > 15) { + gctl_error(req, "Label cannot exceed 15 characters"); + return; + } + /* * Clear last sector first to spoil all components if device = exists. */ @@ -131,7 +137,6 @@ label_label(struct gctl_req *req) =20 strlcpy(md.md_magic, G_LABEL_MAGIC, sizeof(md.md_magic)); md.md_version =3D G_LABEL_VERSION; - label =3D gctl_get_ascii(req, "arg0"); strlcpy(md.md_label, label, sizeof(md.md_label)); md.md_provsize =3D g_get_mediasize(name); if (md.md_provsize =3D=3D 0) { Lucas Holt Luke@FoolishGames.com ________________________________________________________ MidnightBSD.org (Free OS) JustJournal.com (Free blogging)