Project

General

Profile

« Previous | Next » 

Revision cc3990a3

Added by Jim Pingle over 5 years ago

Validation and encoding for Ping and Traceroute. Fixes #10355

View differences:

src/usr/local/www/diag_ping.php
68 68
	if (($ipproto == "ipv6") && is_ipaddrv4($host)) {
69 69
		$input_errors[] = gettext("When using IPv6, the target host must be an IPv6 address or hostname.");
70 70
	}
71
	if (!is_ipaddr($host) && !is_hostname($host)) {
72
		$input_errors[] = gettext("Hostname must be a valid hostname or IP address.");
73
	}
71 74

  
72 75
	if (!$input_errors) {
73 76
		if ($_POST) {
......
185 188
		</div>
186 189

  
187 190
		<div class="panel-body">
188
			<pre><?= $result ?></pre>
191
			<pre><?= htmlspecialchars($result) ?></pre>
189 192
		</div>
190 193
	</div>
191 194
<?php
src/usr/local/www/diag_traceroute.php
71 71
	if (($ipproto == "ipv6") && is_ipaddrv4($host)) {
72 72
		$input_errors[] = gettext("When using IPv6, the target host must be an IPv6 address or hostname.");
73 73
	}
74
	if (!is_ipaddr($host) && !is_hostname($host)) {
75
		$input_errors[] = gettext("Hostname must be a valid hostname or IP address.");
76
	}
74 77

  
75 78
	$sourceip = $_REQUEST['sourceip'];
76 79
	$ttl = $_REQUEST['ttl'];
......
183 186
		<div class="panel-heading"><h2 class="panel-title"><?=gettext('Results')?></h2></div>
184 187
		<div class="panel-body">
185 188
<?php
186
	print('<pre>' . $result . '</pre>');
189
	print('<pre>' . htmlspecialchars($result) . '</pre>');
187 190
?>
188 191
		</div>
189 192
	</div>

Also available in: Unified diff