From patchwork Tue Oct 23 03:51:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 572 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id SLzvH0g2z1ssfwAAIUCqbw for ; Tue, 23 Oct 2018 10:55:04 -0400 Received: from proxy19.mail.ord1d.rsapps.net ([172.30.191.6]) by director9.mail.ord1d.rsapps.net with LMTP id 6FiaH0g2z1uhYAAAalYnBA ; Tue, 23 Oct 2018 10:55:04 -0400 Received: from smtp37.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy19.mail.ord1d.rsapps.net with LMTP id mHpfH0g2z1usYQAAyH2SIw ; Tue, 23 Oct 2018 10:55:04 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp37.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 9f19e50e-d6d3-11e8-a5f2-525400a11cf3-1-1 Received: from [216.105.38.7] ([216.105.38.7:28736] helo=lists.sourceforge.net) by smtp37.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 4C/57-26729-7463FCB5; Tue, 23 Oct 2018 10:55:03 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1gEy4O-0005y1-IQ; Tue, 23 Oct 2018 14:54:08 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gEy4N-0005xa-60 for openvpn-devel@lists.sourceforge.net; Tue, 23 Oct 2018 14:54:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:To: From:Sender:Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=q1gRyg2+y99tob2Zzph1RKHNOvR9zU7IvAd9PHEU9lE=; b=lDLch8HroJKF4oXHbw7732qrvK 7KySbQ4BnuGbU1iNBL5QDi1F/uT5hkHqNOORB9u9TP8RVCSHpRWZMoZ6n2Hiv4TocSQf4Dphet9TC UZdiVg393QefnT7K2/SNW7Bn+3yLDBvDbu+yBUNVd7TfM4pQ+iPgJgpLWvDKpCJgArTM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc :MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=q1gRyg2+y99tob2Zzph1RKHNOvR9zU7IvAd9PHEU9lE=; b=d188cQd0EHEz5u1U1jTQrXaabM Pi0R1TViUkDu5aHeA/wMPN0fpWnP7xgce9fg0LHhKgFE9QEN1gDISKZ5YH1OFK8Prr/tiV6q7lLf2 EzugAMts5x6gFc4B2hyb6EnvzsDUQ0RSnsbiYWr57160FWbhHLxkud6oJtKLsSetn1Z8=; Received: from mail-ed1-f67.google.com ([209.85.208.67]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) id 1gEy4L-008vND-Mt for openvpn-devel@lists.sourceforge.net; Tue, 23 Oct 2018 14:54:07 +0000 Received: by mail-ed1-f67.google.com with SMTP id b7-v6so1910011edd.9 for ; Tue, 23 Oct 2018 07:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=q1gRyg2+y99tob2Zzph1RKHNOvR9zU7IvAd9PHEU9lE=; b=EQuSP8aaGUUz8zU8qkKfBHB/kL/qhJZJT1kmGnhsXX2h8PLIbbDj5qBjRa75KfQzuJ gxnLyDbUZUjqCTmFx+QgPPBJSObA71xTBhazNDl7OpSU2zgAD5fyg1qh/ZOPdCzMHgcH +ew+FTX8TIrh2CeA2xU3YrOr0YLn+1s4ssC5yRcQoxS6cHs6kl6AeWAJ8iWQBv6RkuJl FppzFgk+qEeUiocAZVJLqaM6VE9FpAu5QgKZt5TEXK7B65uJA2FwAoiGEWuRyQcFlQiw d+tF32Pu6yUmgMM1TRyOofhO12mL6Gdw40FCpbNL9NnoabN9Rrmr6tnGA9p7SXoOhjfo Br/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=q1gRyg2+y99tob2Zzph1RKHNOvR9zU7IvAd9PHEU9lE=; b=faME6o1l5NgoVuGbUHmrBiJLTJ9pDXZcDFibPMj5ERvJGnorOWqT0QBG5Q7gh9r3i7 A3Kualy54Vm3UfSNMa1C5qjnBFKcTW8EoBYRNhT7FxNvLobVnGqAZsb0fa1aKnn9hCF3 CrKVsZ5IIF9CZDggIfVuQZInAYKRKzOEmN/YSpiV9srLh1ML9SMJy8u/3mciVmqyfFZV ncILBXN8dhkKP8Yc+HcBS1PmcxGW3txieTggUvV7jdxuQgWGzvxAECtXsNPfiIl6iZJV qkIwek6uPg2Sl/RMYBKFkG92kwyZ/cvUFImcZ6rY0+7/q0dmttzBDWj/LDm8+a+HZM6L Ozkg== X-Gm-Message-State: AGRZ1gLp/xLUTaWHTXme8BlJJxuBhBqGpHM4IzGzSH4iq8/1/sCOjU/6 bD8yQhFCawj9hs8noTjE8fDumBP8seo= X-Google-Smtp-Source: AJdET5fm2TwpAguGkRvssHokgdjL6ffOFu/uyKhOJiSMfzUfPaFsf5lAW+FK4Lz20knlYlEcWnFpEA== X-Received: by 2002:a50:ba4d:: with SMTP id 13-v6mr3854689eds.239.1540306438718; Tue, 23 Oct 2018 07:53:58 -0700 (PDT) Received: from stipakov.fi (stipakov.fi. [128.199.52.117]) by smtp.gmail.com with ESMTPSA id f39-v6sm803937ede.75.2018.10.23.07.53.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Oct 2018 07:53:58 -0700 (PDT) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Tue, 23 Oct 2018 17:51:28 +0300 Message-Id: <1540306288-23847-1-git-send-email-lstipakov@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.208.67 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lstipakov[at]gmail.com) -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.208.67 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1gEy4L-008vND-Mt Subject: [Openvpn-devel] [PATCH] Wrap openvpn_swprintf into Windows define X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Lev Stipakov Commit 43a5a4f3b4e411419639c195fee8a76495fdc88e added vswprintf() call which turned to me missing in OpenBSD 4.9. Since that call is inside openvpn_swprintf() function which is only used by Windows, wrap that function info #ifdef _WIN32. Signed-off-by: Lev Stipakov Acked-by: Antonio Quartulli --- src/openvpn/buffer.c | 3 +++ src/openvpn/buffer.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 8ca189f..acf76ae 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -310,6 +310,7 @@ openvpn_snprintf(char *str, size_t size, const char *format, ...) return (len >= 0 && len < size); } +#ifdef _WIN32 bool openvpn_swprintf(wchar_t *const str, const size_t size, const wchar_t *const format, ...) { @@ -318,12 +319,14 @@ openvpn_swprintf(wchar_t *const str, const size_t size, const wchar_t *const for if (size > 0) { va_start(arglist, format); + /* vswprintf is missing in OpenBSD 4.2 */ len = vswprintf(str, size, format, arglist); va_end(arglist); str[size - 1] = L'\0'; } return (len >= 0 && len < size); } +#endif /* * write a string to the end of a buffer that was diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h index c5b78a0..c48c925 100644 --- a/src/openvpn/buffer.h +++ b/src/openvpn/buffer.h @@ -449,7 +449,11 @@ __attribute__ ((format(__printf__, 3, 4))) ; +#ifdef _WIN32 /* + * This is under #ifdef because only Windows-specific code + * uses this function and its implementation is broken in OpenBSD 4.9 + * * Like swprintf but guarantees null termination for size > 0 */ bool @@ -458,6 +462,7 @@ openvpn_swprintf(wchar_t *const str, const size_t size, const wchar_t *const for * Unlike in openvpn_snprintf, we cannot use format attributes since * GCC doesn't support wprintf as archetype. */ +#endif /* * remove/add trailing characters