in reply to Uncontrolled Memory Allocation

Your first step is to understand what the security issue does mean and what kind of attack it tries to prevent.

The next step is to check if there are sane limits you can apply to prevent the issue. In the case of my interpretation of Uncontrolled Memory Allocation, maybe you can restrict the length of the lines used in %file_list to a certain maximum and stop the program otherwise.

Maybe you can alternatively also argue what the maximum memory allocated by this loop is, and ensure that the machines have enough memory.