From owner-svn-src-head@FreeBSD.ORG Sat Feb 28 20:30:26 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9EBAD352; Sat, 28 Feb 2015 20:30:26 +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 89C7D362; Sat, 28 Feb 2015 20:30:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1SKUQOY067862; Sat, 28 Feb 2015 20:30:26 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1SKUQJl067861; Sat, 28 Feb 2015 20:30:26 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201502282030.t1SKUQJl067861@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Sat, 28 Feb 2015 20:30:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279404 - head/lib/libc/iconv 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-1 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: Sat, 28 Feb 2015 20:30:26 -0000 Author: kan Date: Sat Feb 28 20:30:25 2015 New Revision: 279404 URL: https://svnweb.freebsd.org/changeset/base/279404 Log: Avoid lookup of CODESET aliases using uninitialized path We do not use iconv.alias file, so avoid using the vestiges of the code that do. Differential Revision: https://reviews.freebsd.org/D1729 Reviewed by: emaste MFC after: 2 weeks Modified: head/lib/libc/iconv/citrus_iconv.c Modified: head/lib/libc/iconv/citrus_iconv.c ============================================================================== --- head/lib/libc/iconv/citrus_iconv.c Sat Feb 28 20:03:52 2015 (r279403) +++ head/lib/libc/iconv/citrus_iconv.c Sat Feb 28 20:30:25 2015 (r279404) @@ -278,7 +278,9 @@ _citrus_iconv_open(struct _citrus_iconv struct _citrus_iconv *cv = NULL; struct _citrus_iconv_shared *ci = NULL; char realdst[PATH_MAX], realsrc[PATH_MAX]; +#ifdef _PATH_ICONV char buf[PATH_MAX], path[PATH_MAX]; +#endif int ret; init_cache(); @@ -290,10 +292,16 @@ _citrus_iconv_open(struct _citrus_iconv dst = nl_langinfo(CODESET); /* resolve codeset name aliases */ +#ifdef _PATH_ICONV + snprintf(path, sizeof(path), "%s/%s", _PATH_ICONV, _CITRUS_ICONV_ALIAS); strlcpy(realsrc, _lookup_alias(path, src, buf, (size_t)PATH_MAX, _LOOKUP_CASE_IGNORE), (size_t)PATH_MAX); strlcpy(realdst, _lookup_alias(path, dst, buf, (size_t)PATH_MAX, _LOOKUP_CASE_IGNORE), (size_t)PATH_MAX); +#else + strlcpy(realsrc, src, (size_t)PATH_MAX); + strlcpy(realdst, dst, (size_t)PATH_MAX); +#endif /* sanity check */ if (strchr(realsrc, '/') != NULL || strchr(realdst, '/'))