diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-03-11 23:46:43 -0600 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-03-11 23:46:43 -0600 |
commit | 6f838722896279d7531c6a956fbd7cb1c0bb5f3e (patch) | |
tree | 8638f9c154cc8cf30ca5339ae1e323f496803b25 /src/etc/inc | |
parent | bf648a15131033332de1a5f062a3ee204b6d97a1 (diff) | |
download | pfsense-6f838722896279d7531c6a956fbd7cb1c0bb5f3e.zip pfsense-6f838722896279d7531c6a956fbd7cb1c0bb5f3e.tar.gz |
Don't try to put the file contents in place if file is empty. Ticket #5982
Diffstat (limited to 'src/etc/inc')
-rw-r--r-- | src/etc/inc/pfsense-utils.inc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index e364afb..77ca8e2 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -1929,6 +1929,10 @@ function parse_aliases_file($filename, $type = "url", $max_items = -1, $kflc = f * RETURNS an array of ip subnets and ip's or ports and port-ranges, returns NULL upon a error conditions (file not found) */ + if (filesize($filename) == 0) { + log_error(sprintf(gettext("Could not process empty file from alias: %s"), $filename)); + return null; + } $fd = @fopen($filename, 'r'); if (!$fd) { log_error(sprintf(gettext("Could not process aliases from alias: %s"), $filename)); @@ -2179,7 +2183,9 @@ function process_alias_urltable($name, $url, $freq, $forceupdate=false, $validat file_put_contents($urltable_filename, implode("\n", $ports)); } else { $urltable = parse_aliases_file($tmp_urltable_filename, "url", "-1", true); - file_put_contents($urltable_filename, implode("\n", $urltable)); + if (is_array($urltable)) { + file_put_contents($urltable_filename, implode("\n", $urltable)); + } } unlink_if_exists($tmp_urltable_filename); } else { |