Date: Sat, 27 Jan 2018 12:28:53 +0000 (UTC) From: Mariusz Zaborski <oshogbo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328472 - head/sys/geom/label Message-ID: <201801271228.w0RCSrTl063092@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: oshogbo Date: Sat Jan 27 12:28:52 2018 New Revision: 328472 URL: https://svnweb.freebsd.org/changeset/base/328472 Log: Don't truncate name of glabel. If it's to long just report that. Reviewed by: trasz@ Differential Revision: https://reviews.freebsd.org/D13746 Modified: head/sys/geom/label/g_label.c Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Sat Jan 27 11:54:51 2018 (r328471) +++ head/sys/geom/label/g_label.c Sat Jan 27 12:28:52 2018 (r328472) @@ -200,6 +200,7 @@ g_label_create(struct gctl_req *req, struct g_class *m struct g_provider *pp2; struct g_consumer *cp; char name[64]; + int n; g_topology_assert(); @@ -213,7 +214,12 @@ g_label_create(struct gctl_req *req, struct g_class *m } gp = NULL; cp = NULL; - snprintf(name, sizeof(name), "%s/%s", dir, label); + n = snprintf(name, sizeof(name), "%s/%s", dir, label); + if (n >= sizeof(name)) { + if (req != NULL) + gctl_error(req, "Label name %s is too long.", label); + return (NULL); + } LIST_FOREACH(gp, &mp->geom, geom) { pp2 = LIST_FIRST(&gp->provider); if (pp2 == NULL)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801271228.w0RCSrTl063092>