From b67bbb491c15d0371bd9aff50ca2f3f39bc7d6c6 Mon Sep 17 00:00:00 2001 From: cgf Date: Wed, 9 Mar 2005 23:46:49 +0000 Subject: [PATCH] * net.cc (dup_ent): Revert older stupid test for null. Don't copy name if it is NULL. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/net.cc | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3f74133b6d..1db62825b1 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2005-03-09 Christopher Faylor + + * net.cc (dup_ent): Revert older stupid test for null. Don't copy name + if it is NULL. + 2005-03-09 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::eid_pipe_name): Fix format diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 3fee9eb91f..87556dc5b1 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -397,8 +397,7 @@ dup_ent (void *old, void *src0, struct_type type) return NULL; unionent *src = (unionent *) src0; - debug_printf ("duping %sent \"%s\", %p", entnames[type], - src ? src->name : "", src); + debug_printf ("duping %sent \"%s\", %p", entnames[type], src->name, src); /* Find the size of the raw structure minus any character strings, etc. */ int sz, struct_sz; @@ -482,11 +481,14 @@ dup_ent (void *old, void *src0, struct_type type) in each, of course. */ dst->port_proto_addrtype = src->port_proto_addrtype; - /* Copy the name field to dst, using space just beyond the end of - the dst structure. */ char *dp = ((char *) dst) + struct_sz; - strcpy (dst->name = dp, src->name); - dp += namelen; + if (namelen) + { + /* Copy the name field to dst, using space just beyond the end of + the dst structure. */ + strcpy (dst->name = dp, src->name); + dp += namelen; + } /* Copy the 'list' type to dst, using space beyond end of structure + storage for name. */ -- 2.11.0