diff options
author | Richard Sandiford <r.sandiford@uk.ibm.com> | 2009-06-02 19:04:39 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2009-06-02 19:04:39 +0000 |
commit | 51136ae8188c4849ae4fb9451c26ef51f9801d7a (patch) | |
tree | 8e1c4102d3c40d7527e0ec7628300736d8e0be8b /gcc/collect2.c | |
parent | 7f142d333aa8e34f00195a9fffd549a458921434 (diff) | |
download | gcc-51136ae8188c4849ae4fb9451c26ef51f9801d7a.tar.gz |
collect2.c (ignore_library): Avoid premature post-increment and null deference.
gcc/
* collect2.c (ignore_library): Avoid premature post-increment
and null deference.
From-SVN: r148095
Diffstat (limited to 'gcc/collect2.c')
-rw-r--r-- | gcc/collect2.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/collect2.c b/gcc/collect2.c index d15a81af182..a500147e563 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -2448,9 +2448,11 @@ static int ignore_library (const char *); static int ignore_library (const char *name) { - const char *const *p = &aix_std_libs[0]; - while (*p++ != NULL) - if (! strcmp (name, *p)) return 1; + const char *const *p; + + for (p = &aix_std_libs[0]; *p != NULL; ++p) + if (strcmp (name, *p) == 0) + return 1; return 0; } #endif /* COLLECT_EXPORT_LIST */ |