Project

General

Profile

« Previous | Next » 

Revision 28e2b611

Added by Jim Pingle almost 2 years ago

Cast to string before ctype_digit() testing. Fixes #14702

View differences:

src/etc/inc/ipsec.inc
886 886
	$selector = '--';
887 887
	$selector .= ($type == 'ike') ? 'ike' : 'child';
888 888

  
889
	if (ctype_digit($uniqueid) && ($uniqueid > 0)) {
889
	if (ctype_digit(strval($uniqueid)) && ($uniqueid > 0)) {
890 890
		$selector .= '-id';
891 891
		$term = $uniqueid;
892 892
	} else {
src/etc/inc/util.inc
328 328

  
329 329
/* validate non-negative numeric string, or equivalent numeric variable */
330 330
function is_numericint($arg) {
331
	return (((is_int($arg) && $arg >= 0) || (is_string($arg) && strlen($arg) > 0 && ctype_digit($arg))) ? true : false);
331
	return (((is_int($arg) && $arg >= 0) || (is_string($arg) && strlen($arg) > 0 && ctype_digit(strval($arg)))) ? true : false);
332 332
}
333 333

  
334 334
/* Generate the (human readable) ipv4 or ipv6 subnet address (i.e., netmask, or subnet start IP)
......
1244 1244
		return false;
1245 1245
	}
1246 1246

  
1247
	if (!ctype_digit($values[0]) || !ctype_digit($values[1])) {
1247
	if (!ctype_digit(strval($values[0])) || !ctype_digit(strval($values[1]))) {
1248 1248
		return false;
1249 1249
	}
1250 1250

  
......
1264 1264

  
1265 1265
/* returns true if $port is a valid TCP/UDP/SCTP port */
1266 1266
function is_port($port) {
1267
	if (ctype_digit($port) && ((intval($port) >= 1) && (intval($port) <= 65535))) {
1267
	if (ctype_digit(strval($port)) && ((intval($port) >= 1) && (intval($port) <= 65535))) {
1268 1268
		return true;
1269 1269
	}
1270 1270
	if (getservbyname($port, "tcp") || getservbyname($port, "udp") || getservbyname($port, "sctp")) {
src/usr/local/pfSense/include/www/diag_packet_capture.inc
404 404
							$string_part = 'proto ospf';
405 405
							break;
406 406
						default:
407
							if (ctype_digit($value) && ($value >= 0 && $value <= 255)) {
407
							if (ctype_digit(strval($value)) && ($value >= 0 && $value <= 255)) {
408 408
								$string_part = "proto {$value}";
409 409
							} else {
410 410
								$input_error = "Invalid protocol: {$value}";
src/usr/local/pfSense/include/www/services_dnsmasq.inc
316 316
				$entry = substr($key, 16);
317 317
				$field = 'description';
318 318
			}
319
			if (ctype_digit($entry)) {
319
			if (ctype_digit(strval($entry))) {
320 320
				$aliases[$entry][$field] = $value;
321 321
			}
322 322
		}
src/usr/local/www/services_dhcp.php
248 248

  
249 249
	$numberoptions = array();
250 250
	for ($x = 0; $x < 99; $x++) {
251
		if (isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
251
		if (isset($_POST["number{$x}"]) && ctype_digit(strval($_POST["number{$x}"]))) {
252 252
			if ($_POST["number{$x}"] < 1 || $_POST["number{$x}"] > 254) {
253 253
				$input_errors[] = gettext("The DHCP option must be a number between 1 and 254.");
254 254
				continue;
src/usr/local/www/services_dhcp_edit.php
161 161

  
162 162
	$numberoptions = array();
163 163
	for ($x = 0; $x < 99; $x++) {
164
		if (isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
164
		if (isset($_POST["number{$x}"]) && ctype_digit(strval($_POST["number{$x}"]))) {
165 165
			if ($_POST["number{$x}"] < 1 || $_POST["number{$x}"] > 254) {
166 166
				$input_errors[] = gettext("The DHCP option must be a number between 1 and 254.");
167 167
				continue;
src/usr/local/www/services_dhcpv6.php
214 214

  
215 215
	$numberoptions = array();
216 216
	for ($x = 0; $x < 99; $x++) {
217
		if (isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
217
		if (isset($_POST["number{$x}"]) && ctype_digit(strval($_POST["number{$x}"]))) {
218 218
			$numbervalue = array();
219 219
			$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
220 220
			$numbervalue['value'] = base64_encode($_POST["value{$x}"]);
src/usr/local/www/services_unbound_host_edit.php
109 109
				$entry = substr($key, 16);
110 110
				$field = 'description';
111 111
			}
112
			if (ctype_digit($entry)) {
112
			if (ctype_digit(strval($entry))) {
113 113
				array_set_path($aliases, "{$entry}/{$field}", $value);
114 114
			}
115 115
		}
src/usr/local/www/system_certmanager.php
329 329
				$field = 'value';
330 330
			}
331 331

  
332
			if (ctype_digit($entry)) {
332
			if (ctype_digit(strval($entry))) {
333 333
				$entry++;	// Pre-bootstrap code is one-indexed, but the bootstrap code is 0-indexed
334 334
				$altnames[$entry][$field] = $value;
335 335
			}

Also available in: Unified diff