Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-07-03 03:57:05 +0400
committerChristopher Faylor <me@cgf.cx>2002-07-03 03:57:05 +0400
commit5d23017437908b02b99c1041acf229ed6a37289d (patch)
tree4182e7b036bf4a36e55eaa1d9d9890447b1f50cf
parent0bf10df1efd0ae5a0428e1e61cc7beaf0bea40ad (diff)
* net.cc (cygwin_getpeername): Defend against NULL pointer dereference.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/net.cc2
2 files changed, 5 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index b1f6708ef..2783c3f75 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2002-07-02 Christopher Faylor <cgf@redhat.com>
+
+ * net.cc (cygwin_getpeername): Defend against NULL pointer dereference.
+
2002-07-02 Egor Duda <deo@logos-m.ru>
* include/cygwin/version.h: Bump API minor version.
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index c54dc7eed..870bf7865 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -1131,7 +1131,7 @@ cygwin_getpeername (int fd, struct sockaddr *name, int *len)
if (fh)
res = fh->getpeername (name, len);
- syscall_printf ("%d = getpeername %d", res, fh->get_socket ());
+ syscall_printf ("%d = getpeername %d", res, (fh ? fh->get_socket () : -1));
return res;
}