From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Segmentation Fault of ssh3.7.1 with cygwin1.5.5-1 in W95
Date: Mon, 03 Nov 2003 19:06:00 -0000 [thread overview]
Message-ID: <20031103190632.GL18706@cygbert.vinschen.de> (raw)
In-Reply-To: <20031103183956.GA223527@Worldnet>
On Mon, Nov 03, 2003 at 01:39:56PM -0500, Pierre A. Humblet wrote:
> On Mon, Nov 03, 2003 at 05:31:15PM +0100, Corinna Vinschen wrote:
> > On Sun, Nov 02, 2003 at 09:43:14AM -0500, Pierre A. Humblet wrote:
> > > Pierre A. Humblet wrote:
> > >
> > > > The real problem is that the s_proto pointer of the struct servent
> > > > returned by the Windows getservbyname on Win95 is invalid.
> > >
> > > Looking at net.cc, this problem seems to be well known.
> > > However the workaround is only applied when copying the string,
> > > not when computing its length.
> >
> > I see. I'll create a patch.
>
> I started one already, must still compile and test.
> Let me know if you proceed on your side.
I have a patch ready and it seems to work fine(tm). Would you mind
to give it a try on 95? Patch below.
Corinna
Index: net.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/net.cc,v
retrieving revision 1.154
diff -u -p -r1.154 net.cc
--- net.cc 25 Sep 2003 00:37:17 -0000 1.154
+++ net.cc 3 Nov 2003 19:06:12 -0000
@@ -499,8 +499,21 @@ dup_ent (void *old, void *src0, struct_t
/* Do servent/hostent specific processing */
int protolen = 0;
int addr_list_len = 0;
+ char *s_proto = NULL;
if (type == is_servent)
- sz += (protolen = strlen_round (src->s_proto));
+ {
+ if (src->s_proto)
+ {
+ /* Windows 95 idiocy. Structure is misaligned on Windows 95.
+ Kludge around this by trying a different pointer alignment. */
+ if (IsBadReadPtr (src->s_proto, sizeof (src->s_proto))
+ && !IsBadReadPtr (((pservent *) src)->s_proto, sizeof (src->s_proto)))
+ s_proto = ((pservent *) src)->s_proto;
+ else
+ s_proto = src->s_proto;
+ }
+ sz += (protolen = strlen_round (s_proto));
+ }
else if (type == is_hostent)
{
/* Calculate the length and storage used for h_addr_list */
@@ -549,16 +562,8 @@ dup_ent (void *old, void *src0, struct_t
/* Do servent/hostent specific processing. */
if (type == is_servent)
{
- if (src->s_proto)
+ if (s_proto)
{
- char *s_proto;
- /* Windows 95 idiocy. Structure is misaligned on Windows 95.
- Kludge around this by trying a different pointer alignment. */
- if (IsBadReadPtr (src->s_proto, sizeof (src->s_proto))
- && !IsBadReadPtr (((pservent *) src)->s_proto, sizeof (src->s_proto)))
- s_proto = ((pservent *) src)->s_proto;
- else
- s_proto = src->s_proto;
strcpy (dst->s_proto = dp, s_proto);
dp += protolen;
}
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
next prev parent reply other threads:[~2003-11-03 19:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-30 0:29 Rodrigo Medina
2003-10-30 4:34 ` Pierre A. Humblet
2003-10-30 12:10 ` Corinna Vinschen
2003-10-31 3:44 ` Pierre A. Humblet
2003-10-31 13:09 ` Corinna Vinschen
2003-11-01 0:13 ` Pierre A. Humblet
2003-11-01 12:27 ` Corinna Vinschen
2003-11-02 4:28 ` Pierre A. Humblet
2003-11-02 14:58 ` Pierre A. Humblet
2003-11-03 16:31 ` Corinna Vinschen
2003-11-03 18:17 ` Pierre A. Humblet
2003-11-03 19:06 ` Corinna Vinschen [this message]
2003-11-04 3:09 ` Pierre A. Humblet
2003-11-04 12:57 ` Christopher Faylor
2003-10-31 9:17 ` Christian Weinberger
-- strict thread matches above, loose matches on Subject: below --
2003-10-28 20:57 Rodrigo Medina
2003-10-29 9:40 ` Corinna Vinschen
2003-10-31 21:40 ` Christian Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031103190632.GL18706@cygbert.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).