Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [day] [month] [year] [list]
Date: Wed, 01 Jul 2015 02:07:16 +0200
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: getopt.c patch

Solar,

I have applied the attached fix to Jumbo. I suggest you apply it to core 
- it's a bug fix of sorts.

Without this fix, an option argument can not contain an equal sign, if 
the parameter delimiter is a colon (a contrived core example would be 
--session:weird=name). All other combinations work. For Jumbo, this 
limitation would be very confusing for upcoming functionality.

magnum

commit bd79343b7e0a36a6ac4fb8756b5b156531eb6f93
Author: magnum <john.magnum@...hmail.com>
Date:   Wed Jul 1 01:44:58 2015 +0200

    Allow an option argument string to contain an equal sign when
    the delimiter is a colon. Closes #1481.

diff --git a/src/getopt.c b/src/getopt.c
index 531eaa3..8ee3a52 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -43,6 +43,9 @@ static char *opt_find(struct opt_entry *list, char *opt,
 		if (!(param = strchr(name, '=')))
 			param = strchr(name, ':');
 		if (param) {
+			char *c = strchr(name, ':');
+			if (c && param > c)
+				param = c;
 			length = param - name;
 			if (!*++param) param = NULL;
 		} else

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ