----- Original Message -----
From: Lucas Holt <l...@foolishgames.com>
To: rank1see...@gmail.com
Cc: hack...@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, rank1see...@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
> l...@foolishgames.com
> ________________________________________________________
> MidnightBSD.org (Free OS)
> JustJournal.com (Free blogging)
> 


Thanks.
Well, yes. Limit isn't a problem, but a silent ignore.


_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to