mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
An empty file does not have a positive number of lines.
Make sure that the number of lines read is non-zero before in order to avoid dumping core. Reported by: Wojciech A. Koszek Pointy hat to: cperciva
This commit is contained in:
parent
359d438885
commit
3d19fd3190
1 changed files with 7 additions and 0 deletions
|
|
@ -411,6 +411,7 @@ printport(PORT * p)
|
|||
/*
|
||||
* Algorithm:
|
||||
* 1. Suck in all the data, splitting into fields.
|
||||
* 1a. If there are no ports, there is no INDEX.
|
||||
* 2. Sort the ports according to port directory.
|
||||
* 3. Using a binary search, translate each dependency from a
|
||||
* port directory name into a pointer to a port.
|
||||
|
|
@ -469,6 +470,12 @@ main(int argc, char *argv[])
|
|||
if (fclose(f) != 0)
|
||||
err(1, "fclose(%s)", argv[1]);
|
||||
|
||||
/*
|
||||
* 1a. If there are no ports, there is no INDEX.
|
||||
*/
|
||||
if (pplen == 0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* 2. Sort the ports according to port directory.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue