From ea51d3d4250a1b51efed8fc8442381041d59441d Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 4 Jul 2012 17:30:55 +0000 Subject: [PATCH] * dcrt0.cc (build_argv): Guard against NULL pointer dereference found by Clang. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/dcrt0.cc | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ba9464d26..e041729ca 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2012-07-04 Christopher Faylor + + * dcrt0.cc (build_argv): Guard against NULL pointer dereference found + by Clang. + 2012-07-04 Christopher Faylor * exceptions.cc (setup_handler): Remove unneeded assignment found by diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index e28aecde9..70b962889 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -353,7 +353,8 @@ build_argv (char *cmd, char **&argv, int &argc, int winshell) } } - argv[argc] = NULL; + if (argv) + argv[argc] = NULL; debug_printf ("argc %d", argc); }