From c8b221e03fbc34e111b7a0a3b8a2d3fa75de609e Mon Sep 17 00:00:00 2001 From: George McWilliams Date: Thu, 18 Jun 2015 13:55:19 -0600 Subject: [PATCH] Uninitialized variable can cause hardfault from getopt if required argument is missing. --- libc/unistd/lib_getopt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/unistd/lib_getopt.c b/libc/unistd/lib_getopt.c index 4399e6140b..bda9666be5 100644 --- a/libc/unistd/lib_getopt.c +++ b/libc/unistd/lib_getopt.c @@ -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++;