Don't crash with -p without a password, problem reported by Rodolfo Gouveia

(getopt string bug, fix is committed upstream too)
This commit is contained in:
sthen 2012-08-31 12:30:56 +00:00
parent d475b0a293
commit eb09d327e4
2 changed files with 33 additions and 1 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.10 2012/08/23 16:43:10 sthen Exp $
# $OpenBSD: Makefile,v 1.11 2012/08/31 12:30:56 sthen Exp $
COMMENT= client for Cisco AnyConnect SSL VPN
DISTNAME= openconnect-4.06
REVISION= 0
DIST_SUBDIR= openconnect
VPNC_SCRIPT= vpnc-script
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} ${VPNC_SCRIPT}:0

View File

@ -0,0 +1,31 @@
$OpenBSD: patch-main_c,v 1.1 2012/08/31 12:30:56 sthen Exp $
http://git.infradead.org/users/dwmw2/openconnect.git/commit/8e16a755388ffea541a4543e252ebbe297d2eee8
--- main.c.orig Thu Jul 12 13:57:30 2012
+++ main.c Wed Aug 29 21:06:56 2012
@@ -338,7 +338,7 @@ static int next_option(int argc, char **argv, char **c
next:
if (!config_file) {
opt = getopt_long(argc, argv,
- "bC:c:e:Ddg:hi:k:lpP:Q:qSs:U:u:Vvx:",
+ "bC:c:e:Ddg:hi:k:lp:P:Q:qSs:U:u:Vvx:",
long_options, NULL);
*config_arg = optarg;
@@ -596,9 +596,13 @@ int main(int argc, char **argv)
}
break;
case 'p':
- vpninfo->cert_password = strdup(config_arg);
+ if(config_arg)
+ vpninfo->cert_password = strdup(config_arg);
+ else {
+ fprintf(stderr, _("-p specified but no password given.\n"));
+ }
break;
- case 'P':
+ case 'P':
proxy = keep_config_arg();
autoproxy = 0;
break;