From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 7 16:39:31 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 DA8ED1065675 for ; Mon, 7 Nov 2011 16:39:31 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 72F9A8FC15 for ; Mon, 7 Nov 2011 16:39:31 +0000 (UTC) Received: by faar19 with SMTP id r19so7529079faa.13 for ; Mon, 07 Nov 2011 08:39:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:from:to:subject:date:in-reply-to:references:x-mailer; bh=D+iR3Ib5q0xBrBD/ZRDMHm81Hwdpl3oHBK5Mr7F5Whk=; b=wpREzyXG37t+amPQMMrKVKMmjgsTTICYMKFmuupNHDhcg4CuGpmo5UtsxTf1L+zSPy JbqTbfvtxPULb0+ccbmPG63mCvgr7d0VePSKwWHmOMmz4RbR/RyE3NEH1FPOX7/FbQ3Q XNgMH/1qkL7BGjVziQp8HmF3mNYxLzy/NkOLg= Received: by 10.223.77.66 with SMTP id f2mr47759688fak.24.1320683970380; Mon, 07 Nov 2011 08:39:30 -0800 (PST) Received: from DOMYPC ([82.193.208.173]) by mx.google.com with ESMTPS id k26sm31845967fab.8.2011.11.07.08.39.25 (version=SSLv3 cipher=OTHER); Mon, 07 Nov 2011 08:39:28 -0800 (PST) Message-ID: <20111107.163922.409.1@DOMY-PC> From: rank1seeker@gmail.com To: "Lucas Holt" , hackers@freebsd.org Date: Mon, 07 Nov 2011 17:39:22 +0100 In-Reply-To: <1859A0FF-C3BF-4EC3-9CC6-FA97B9AF5C99@foolishgames.com> References: <20111105.110247.867.1@DOMY-PC> <1859A0FF-C3BF-4EC3-9CC6-FA97B9AF5C99@foolishgames.com> X-Mailer: POP Peeper (3.8.0.0) Cc: 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: Mon, 07 Nov 2011 16:39:31 -0000 ----- Original Message ----- From: Lucas Holt To: rank1seeker@gmail.com Cc: hackers@freebsd.org Date: Sat, 5 Nov 2011 10:24:04 -0400 Subject: Re: BUG: 'glabel label' name's lenght, is truncated without err/warn > > On Nov 5, 2011, at 7:02 AM, rank1seeker@gmail.com wrote: > > > 8.2R p4 both i386/amd64 > > > > > > Supplied name of 16 chars > > -- > > # glabel label -v swap_679592d048a ada0s3b > > Metadata value stored on ada0s3b. > > Done. > > -- > > > > Truncated to 15 chars > > -- > > # ll /dev/label > > total 0 > > crw-r----- 1 root operator - 0, 133 Nov 5 11:41:54 2011 swap_679592d048 > > -- > > > > > 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; > } > > + label = 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) > > strlcpy(md.md_magic, G_LABEL_MAGIC, sizeof(md.md_magic)); > md.md_version = G_LABEL_VERSION; > - label = gctl_get_ascii(req, "arg0"); > strlcpy(md.md_label, label, sizeof(md.md_label)); > md.md_provsize = g_get_mediasize(name); > if (md.md_provsize == 0) { > > Lucas Holt > Luke@FoolishGames.com > ________________________________________________________ > MidnightBSD.org (Free OS) > JustJournal.com (Free blogging) > Thanks. Well, yes. Limit isn't a problem, but a silent ignore.