diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2013-11-12 11:30:32 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2013-11-12 11:30:32 +0000 |
commit | f1359420dab7df04acde5834f20d991372224a70 (patch) | |
tree | 38ba9118c70f4a0c43ba9fdfcc077113cf6bba4e /newlib | |
parent | 4146cc5ce7b36355adbfef690d19762c74041b53 (diff) | |
download | cygnal-f1359420dab7df04acde5834f20d991372224a70.tar.gz cygnal-f1359420dab7df04acde5834f20d991372224a70.tar.bz2 cygnal-f1359420dab7df04acde5834f20d991372224a70.zip |
* libc/libc/stdlib/getopt.c (getopt_internal): Fix NULL pointer access.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 4 | ||||
-rw-r--r-- | newlib/libc/stdlib/getopt.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index b5cec73c3..65d473467 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,7 @@ +2013-11-12 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * libc/libc/stdlib/getopt.c (getopt_internal): Fix NULL pointer access. + 2013-11-08 Terry Guo <terry.guo@arm.com> * libm/libm.texinfo: Rename node Index to Document Index. diff --git a/newlib/libc/stdlib/getopt.c b/newlib/libc/stdlib/getopt.c index 2bea694e8..2a4e7d4a2 100644 --- a/newlib/libc/stdlib/getopt.c +++ b/newlib/libc/stdlib/getopt.c @@ -269,6 +269,10 @@ getopt_internal (int argc, char *const argv[], const char *shortopts, break; } } + /* End of option list? */ + if (argv[data->optind] == 0) + return EOF; + /* we've got an option, so parse it */ /* first, is it a long option? */ |