Uninitialized variable can cause hardfault from getopt if required argument is missing.

This commit is contained in:
George McWilliams 2015-06-18 13:55:19 -06:00 committed by Gregory Nutt
parent d8da1d61ec
commit c8b221e03f
1 changed files with 1 additions and 0 deletions

View File

@ -258,6 +258,7 @@ int getopt(int argc, FAR char *const argv[], FAR const char *optstring)
/* No argument was supplied */
g_optptr = NULL;
optarg = NULL;
optopt = *optchar;
optind++;