diff options
author | Christopher Faylor <me@cgf.cx> | 2011-10-23 17:19:17 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2011-10-23 17:19:17 +0000 |
commit | 1f012519e4954361e3f5c8ad4eab79cde57a510c (patch) | |
tree | 77ee84ad7d0e75568cfe6de08dfba3d3ad260203 /winsup/cygwin/path.cc | |
parent | 6ae28c22639d43de76a9d45362df5055cd38a867 (diff) | |
download | cygnal-1f012519e4954361e3f5c8ad4eab79cde57a510c.tar.gz cygnal-1f012519e4954361e3f5c8ad4eab79cde57a510c.tar.bz2 cygnal-1f012519e4954361e3f5c8ad4eab79cde57a510c.zip |
* path.cc (path_conv::get_nt_native_path): Avoid dereferencing path when it is
NULL.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 97cf9e5d4..021e7dff4 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -450,15 +450,21 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath, bool dos) PUNICODE_STRING path_conv::get_nt_native_path () { - if (!wide_path) + PUNICODE_STRING res; + if (wide_path) + res = &uni_path; + else if (!path) + res = NULL; + else { uni_path.Length = 0; uni_path.MaximumLength = (strlen (path) + 10) * sizeof (WCHAR); wide_path = (PWCHAR) cmalloc_abort (HEAP_STR, uni_path.MaximumLength); uni_path.Buffer = wide_path; ::get_nt_native_path (path, uni_path, has_dos_filenames_only ()); + res = &uni_path; } - return &uni_path; + return res; } PWCHAR |