From: Antonio Quartulli
Date: Sat, 23 Jun 2018 02:11:47 +0000 (+0800)
Subject: add support for %lu in argv_printf and prevent ASSERT
X-Git-Tag: v2.4.7~39
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61dcf1513d69ddf1261402744496436923ec14bb;p=thirdparty%2Fopenvpn.git
add support for %lu in argv_printf and prevent ASSERT
%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
Acked-by: Gert Doering
Message-Id: <20180623021147.22792-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg17115.html
Signed-off-by: Gert Doering
(cherry picked from commit e38d3a004195f33c5c04fe7c04db5d66c53241bc)
---
diff --git a/src/openvpn/argv.c b/src/openvpn/argv.c
index 124e1c434..7d06951b1 100644
--- a/src/openvpn/argv.c
+++ b/src/openvpn/argv.c
@@ -250,6 +250,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];