From owner-svn-src-head@FreeBSD.ORG Fri May 30 10:35:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7863C12B; Fri, 30 May 2014 10:35:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65B972777; Fri, 30 May 2014 10:35:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4UAZqTp086733; Fri, 30 May 2014 10:35:52 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4UAZpeV086730; Fri, 30 May 2014 10:35:51 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201405301035.s4UAZpeV086730@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 30 May 2014 10:35:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266880 - head/sys/geom/part X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 May 2014 10:35:52 -0000 Author: ae Date: Fri May 30 10:35:51 2014 New Revision: 266880 URL: http://svnweb.freebsd.org/changeset/base/266880 Log: Use g_conf_printf_escaped() to escape symbols, which can break an XML tree. MFC after: 1 week Modified: head/sys/geom/part/g_part_apm.c head/sys/geom/part/g_part_gpt.c head/sys/geom/part/g_part_pc98.c Modified: head/sys/geom/part/g_part_apm.c ============================================================================== --- head/sys/geom/part/g_part_apm.c Fri May 30 10:18:01 2014 (r266879) +++ head/sys/geom/part/g_part_apm.c Fri May 30 10:35:51 2014 (r266880) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "g_part_if.h" @@ -310,10 +311,14 @@ g_part_apm_dumpconf(struct g_part_table /* confxml: partition entry information */ strncpy(u.name, entry->ent.ent_name, APM_ENT_NAMELEN); u.name[APM_ENT_NAMELEN] = '\0'; - sbuf_printf(sb, "%s\n", indent, u.name); + sbuf_printf(sb, "%s\n"); strncpy(u.type, entry->ent.ent_type, APM_ENT_TYPELEN); u.type[APM_ENT_TYPELEN] = '\0'; - sbuf_printf(sb, "%s%s\n", indent, u.type); + sbuf_printf(sb, "%s", indent); + g_conf_printf_escaped(sb, "%s", u.type); + sbuf_printf(sb, "\n"); } else { /* confxml: scheme information */ } Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Fri May 30 10:18:01 2014 (r266879) +++ head/sys/geom/part/g_part_gpt.c Fri May 30 10:35:51 2014 (r266880) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "g_part_if.h" @@ -1253,16 +1254,16 @@ g_gpt_printf_utf16(struct sbuf *sb, uint /* Write the Unicode character in UTF-8 */ if (ch < 0x80) - sbuf_printf(sb, "%c", ch); + g_conf_printf_escaped(sb, "%c", ch); else if (ch < 0x800) - sbuf_printf(sb, "%c%c", 0xc0 | (ch >> 6), + g_conf_printf_escaped(sb, "%c%c", 0xc0 | (ch >> 6), 0x80 | (ch & 0x3f)); else if (ch < 0x10000) - sbuf_printf(sb, "%c%c%c", 0xe0 | (ch >> 12), + g_conf_printf_escaped(sb, "%c%c%c", 0xe0 | (ch >> 12), 0x80 | ((ch >> 6) & 0x3f), 0x80 | (ch & 0x3f)); else if (ch < 0x200000) - sbuf_printf(sb, "%c%c%c%c", 0xf0 | (ch >> 18), - 0x80 | ((ch >> 12) & 0x3f), + g_conf_printf_escaped(sb, "%c%c%c%c", 0xf0 | + (ch >> 18), 0x80 | ((ch >> 12) & 0x3f), 0x80 | ((ch >> 6) & 0x3f), 0x80 | (ch & 0x3f)); } } Modified: head/sys/geom/part/g_part_pc98.c ============================================================================== --- head/sys/geom/part/g_part_pc98.c Fri May 30 10:18:01 2014 (r266879) +++ head/sys/geom/part/g_part_pc98.c Fri May 30 10:35:51 2014 (r266880) @@ -300,7 +300,9 @@ g_part_pc98_dumpconf(struct g_part_table sbuf_printf(sb, " xs PC98 xt %u sn %s", type, name); } else { /* confxml: partition entry information */ - sbuf_printf(sb, "%s\n", indent, name); + sbuf_printf(sb, "%s\n"); if (entry->ent.dp_mid & PC98_MID_BOOTABLE) sbuf_printf(sb, "%sbootable\n", indent);