[Differential] D5853: dhclient: Log a warning instead of bailing upon "illegal" options

Phabricator phabric-noreply at FreeBSD.org
Wed Apr 20 23:56:45 UTC 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rS298385: dhclient: Log a warning instead of bailing upon "illegal" options (authored by sephe).

CHANGED PRIOR TO COMMIT
  https://reviews.freebsd.org/D5853?vs=14915&id=15413#toc

REPOSITORY
  rS FreeBSD src repository

CHANGES SINCE LAST UPDATE
  https://reviews.freebsd.org/D5853?vs=14915&id=15413

REVISION DETAIL
  https://reviews.freebsd.org/D5853

AFFECTED FILES
  head/sbin/dhclient/dhclient.c

CHANGE DETAILS
  diff --git a/head/sbin/dhclient/dhclient.c b/head/sbin/dhclient/dhclient.c
  --- a/head/sbin/dhclient/dhclient.c
  +++ b/head/sbin/dhclient/dhclient.c
  @@ -2275,6 +2275,17 @@
   {
   	int i, j, namelen;
   
  +	/* No `` or $() command substitution allowed in environment values! */
  +	for (j=0; j < strlen(value); j++)
  +		switch (value[j]) {
  +		case '`':
  +		case '$':
  +			warning("illegal character (%c) in value '%s'",
  +			    value[j], value);
  +			/* Ignore this option */
  +			return;
  +		}
  +
   	namelen = strlen(name);
   
   	for (i = 0; client->scriptEnv[i]; i++)
  @@ -2311,16 +2322,6 @@
   	    strlen(value) + 1);
   	if (client->scriptEnv[i] == NULL)
   		error("script_set_env: no memory for variable assignment");
  -
  -	/* No `` or $() command substitution allowed in environment values! */
  -	for (j=0; j < strlen(value); j++)
  -		switch (value[j]) {
  -		case '`':
  -		case '$':
  -			error("illegal character (%c) in value '%s'", value[j],
  -			    value);
  -			/* not reached */
  -		}
   	snprintf(client->scriptEnv[i], strlen(prefix) + strlen(name) +
   	    1 + strlen(value) + 1, "%s%s=%s", prefix, name, value);
   }

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: sepherosa_gmail.com, network, secteam, delphij, glebius, adrian, honzhan_microsoft.com, howard0su_gmail.com, decui_microsoft.com, freebsd-net-list, pkelsey, gnn, jhb
Cc: sbruno
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5853.15413.patch
Type: text/x-patch
Size: 1091 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20160420/01cb5045/attachment.bin>


More information about the freebsd-net mailing list