Project

General

Profile

Actions

Bug #15423

closed

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

Added by Jim Pingle 2 months ago. Updated 23 days ago.

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

100%

Estimated time:
Plus Target Version:
24.08
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

Actions #1

Updated by Jim Pingle about 1 month ago

  • Plus Target Version changed from 24.07 to 24.08
Actions #2

Updated by Marcos M 30 days ago

  • Status changed from New to Pull Request Review
  • Assignee set to Marcos M
Actions #3

Updated by Marcos M 26 days ago

  • Status changed from Pull Request Review to Feedback
  • % Done changed from 0 to 100
Actions #4

Updated by Georgiy Tyutyunnik 23 days ago

reproduce on 24.03 by manually creating empty file /tmp/.interfaces.apply

tested on
24.08-DEVELOPMENT (amd64)
built on Fri Jun 7 6:01:00 UTC 2024
FreeBSD 15.0-CURRENT

this version fixes the issue

Actions #5

Updated by Marcos M 23 days ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF