Fix warnings: ex_cmds2.c: do_source(): Np dereference: FP.

Problem    : Dereference of null pointer @ 2462.
Diagnostic : False positive.
Rationale  : Error occurred if neither loop neither following if were
             entered (this implied `script_items.ga_len < 0`, which
             should not be possible).
Resolution : Assert not negative length (loop or if entered).
This commit is contained in:
Eliseo Martínez 2014-11-08 09:23:55 +01:00
parent 3efd39a41b
commit 739124c1b8

View File

@ -10,6 +10,7 @@
* ex_cmds2.c: some more functions for command line commands
*/
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
@ -2422,6 +2423,7 @@ do_source (
save_current_SID = current_SID;
FileID file_id;
bool file_id_ok = os_fileid((char *)fname_exp, &file_id);
assert(script_items.ga_len >= 0);
for (current_SID = script_items.ga_len; current_SID > 0; --current_SID) {
si = &SCRIPT_ITEM(current_SID);
// Compare dev/ino when possible, it catches symbolic links.