diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-07-09 09:05:17 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-07-09 09:05:17 +0000 |
commit | a8506a19178de9e822fb94b4f7e954643c9e407f (patch) | |
tree | 7b8e09d68c79cfa4fd7d96b9302dc7d1dbec35fc /winsup | |
parent | 5d0cbc17db4a311d723aaa4760194f0c85de98ed (diff) | |
download | newlib-a8506a19178de9e822fb94b4f7e954643c9e407f.zip newlib-a8506a19178de9e822fb94b4f7e954643c9e407f.tar.gz newlib-a8506a19178de9e822fb94b4f7e954643c9e407f.tar.bz2 |
* uinfo.cc (internal_getlogin): Add pointer check.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/cygwin/uinfo.cc | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ea185c9..362a100 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +Mon Jul 9 10:43:00 2001 Corinna Vinschen <corinna@vinschen.de> + + * uinfo.cc (internal_getlogin): Add pointer check. + Mon Jul 9 10:05:00 2001 Corinna Vinschen <corinna@vinschen.de> * security.cc (alloc_sd): Don't set inheritance attribute for diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 32bc260..6f73fbf 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -82,10 +82,14 @@ internal_getlogin (cygheap_user &user) /* HOMEDRIVE and HOMEPATH are wrong most of the time, too, after changing user context! */ sys_mbstowcs (wuser, user.name (), UNLEN + 1); - strcat (strcpy (buf, "\\\\"), user.logsrv ()); - sys_mbstowcs (wlogsrv, buf, INTERNET_MAX_HOST_NAME_LENGTH + 3); + wlogsrv[0] = '\0'; + if (user.logsrv ()) + { + strcat (strcpy (buf, "\\\\"), user.logsrv ()); + sys_mbstowcs (wlogsrv, buf, INTERNET_MAX_HOST_NAME_LENGTH + 3); + } if (!NetUserGetInfo (NULL, wuser, 3, (LPBYTE *)&ui) - || !NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui)) + || (wlogsrv[0] && !NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui))) { sys_wcstombs (buf, ui->usri3_home_dir, MAX_PATH); if (!buf[0]) |