Project

General

Profile

Actions

Bug #15423

open

PHP error when applying interface settings if the ``/tmp/.interfaces.apply`` file is present but empty

Added by Jim Pingle 11 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Interfaces
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
24.07
Release Notes:
Default
Affected Version:
Affected Architecture:

Description

If the /tmp/.interfaces.apply file is present but empty it can lead to a PHP error when applying interface settings on interface.php:

Apr 21 06:55:04 pfsim php-fpm[429]: /interfaces.php: PHP ERROR: Type: 1, File: /etc/inc/util.inc, Line: 3723, Message: Uncaught TypeError: array_set_path(): Argument #1 ($arr) must be of type array, false given, called in /usr/local/www/interfaces.php on line 1781 and defined in /etc/inc/util.inc:3723
Apr 21 06:55:04 pfsim php-fpm[429]: Stack trace:
Apr 21 06:55:04 pfsim php-fpm[429]: #0 /usr/local/www/interfaces.php(1781): array_set_path(false, 'lan/ifcfg', Array)
Apr 21 06:55:04 pfsim php-fpm[429]: #1 {main}
Apr 21 06:55:04 pfsim php-fpm[429]:   thrown

The code checks if the file is present but doesn't ensure the contents are sane. It should check if the unserialize() result is valid or not before proceeding and wipe the file if it isn't.

Note that this read happens twice in interfaces.php around line 472 (Plus)/453 (CE) and line 1777 (Plus)/1721 (CE)

See also: https://forum.netgate.com/topic/187547/netgate-7100-24-03-rc-50x-error-when-modifying-interfaces

No data to display

Actions

Also available in: Atom PDF