From patchwork Fri Jun 22 16:11:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 380 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.27.255.54]) by backend30.mail.ord1d.rsapps.net (Dovecot) with LMTP id q86JNrSsLVtEEQAAIUCqbw for ; Fri, 22 Jun 2018 22:13:08 -0400 Received: from proxy7.mail.iad3a.rsapps.net ([172.27.255.54]) by director9.mail.ord1d.rsapps.net (Dovecot) with LMTP id jf2dCbSsLVunHQAAalYnBA ; Fri, 22 Jun 2018 22:13:08 -0400 Received: from smtp8.gate.iad3a ([172.27.255.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy7.mail.iad3a.rsapps.net with LMTP id QPp3L7SsLVvtTQAAnPvY+A ; Fri, 22 Jun 2018 22:13:08 -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: smtp8.gate.iad3a.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; dmarc=none (p=nil; dis=none) header.from=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: f8452c1e-768a-11e8-a7ed-525400b8fe03-1-1 Received: from [216.105.38.7] ([216.105.38.7:27640] helo=lists.sourceforge.net) by smtp8.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 54/52-01959-4BCAD2B5; Fri, 22 Jun 2018 22:13:08 -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 1fWY2C-00089u-4V; Sat, 23 Jun 2018 02:12:16 +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 1fWY29-00089n-Vn for openvpn-devel@lists.sourceforge.net; Sat, 23 Jun 2018 02:12:13 +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:Cc: To:From:Sender:Reply-To: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=IHI8o39zv9SSIqdAYZGEU9d5eYpFQ3asB+IgE2eQlWA=; b=OHZ0Hsbfb/FE6lxH8W9Pu+OUYH ZwbJ5goJ5UtzdKOsH1kKMc3TeGBdbemMknkt+XVZYZ8aMON+nE2axhX843jgGGrQFeo0mXborvY70 bk9ExAyzAnT0Y0JB15knz59E553q0gDCi8qdzujRa4u/d8BV31CO/CI2MCQPoynfcuBg=; 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:Cc:To:From:Sender:Reply-To :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=IHI8o39zv9SSIqdAYZGEU9d5eYpFQ3asB+IgE2eQlWA=; b=SN3AeL+V3lZq8nx5PeVewjqgXB HgWogRLWH5Pxbs61V1h2E3f9WI6iytvy6GSBFZJPdPN4ztHpFKQz28LOqb1LqCOAnZ9YQ9799qHtk 7R42gNfjQStAqwJ9UXPKOd2Mu96BA2EaD+ppPXTcxrLW+OeRAr5U7MbuF9QsS3J8e1jg=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1fWY28-003r6Z-F6 for openvpn-devel@lists.sourceforge.net; Sat, 23 Jun 2018 02:12:13 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Sat, 23 Jun 2018 10:11:47 +0800 Message-Id: <20180623021147.22792-1-a@unstable.cc> In-Reply-To: <20180622102110.21888-1-a@unstable.cc> References: <20180622102110.21888-1-a@unstable.cc> 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 [5.148.176.60 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1fWY28-003r6Z-F6 Subject: [Openvpn-devel] [PATCH v2] add support for %lu in argv_printf and prevent ASSERT 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: , Cc: Antonio Quartulli MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox %lu is not supported by our tiny argv_printf implementation, therefore it will trigger an ASSERT() when parsing it at route.c:1638. Add support for '%lu' in argv_print() and prevent the ASSERT from being triggered. Signed-off-by: Antonio Quartulli --- It seems I managed to trigger this ASSERT when connecting to my v6-only server with "gateway-redirect !ipv4 ipv6" set. Not sure why this issue hasn't surfaced earlier though. Changes from v1: - keep format string as "%lu" but add support for it in argv_printf() - tested on Windows 10 on top of the ipv6-only branch src/openvpn/argv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/openvpn/argv.c b/src/openvpn/argv.c index dec7e3bf..9100a196 100644 --- a/src/openvpn/argv.c +++ b/src/openvpn/argv.c @@ -251,6 +251,13 @@ argv_printf_arglist(struct argv *a, const char *format, va_list arglist) openvpn_snprintf(numstr, sizeof(numstr), "%u", va_arg(arglist, unsigned int)); argv_append(a, string_alloc(numstr, NULL)); } + else if (!strcmp(term, "%lu")) + { + char numstr[64]; + openvpn_snprintf(numstr, sizeof(numstr), "%lu", + va_arg(arglist, unsigned long)); + argv_append(a, string_alloc(numstr, NULL)); + } else if (!strcmp(term, "%s/%d")) { char numstr[64];