[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev [PATCH] to dev15 - fix for win32
From: |
Klaus Weide |
Subject: |
Re: lynx-dev [PATCH] to dev15 - fix for win32 |
Date: |
Mon, 22 Nov 1999 06:26:33 -0600 (CST) |
On Mon, 22 Nov 1999, Leonid Pauzner wrote:
> > * Bug in LYGetHostByName code fixed (Windows only problem). - SH
>
> This is not windows-only changes - there is the #else case.
>
> [I have no sources handy but seems strange how else that was worked
> on Unixes previously: valid_hostname(host) was called for unitialized
> argument?]
No, the `host = str;' that comes later is an unnecessary duplication; the
function begins with:
PUBLIC struct hostent * LYGetHostByName ARGS1(
CONST char *, str)
{
#ifndef _WINDOWS_NSL
CONST char *host = str;
#endif /* _WINDOWS_NSL */
When LYGetHostByName is called from HTParseInet (the usual case, except
for "guessing"), then the _WINDOWS_NSL-specific `strncpy(host, str,
(size_t)512);' in LYGetHostByName is *also* a duplication of something
that already happens in HTParseInet. (In fact it seems the strncpy in
LYGetHostByName would copy `host' onto itself - `str' already IS a
pointer to `host' -, that doesn't look like healthy practice.)
> > --- lynx283.d15/WWW/Library/Implementation/HTTCP.c Thu Oct 21 23:56:48
> > 1999
> > +++ lynx283.w32/WWW/Library/Implementation/HTTCP.c Mon Nov 22 10:21:04
> > 1999
> > @@ -693,6 +693,12 @@
> > return NULL;
> > }
>
> > +#ifdef _WINDOWS_NSL /* 1999/11/21 (Sun) 21:35:19 */
> > + strncpy(host, str, (size_t)512);
> > +#else
> > + host = str;
> > +#endif /* _WINDOWS_NSL */
> > +
> > if (!valid_hostname(host)) {
> > lynx_nsl_status = HT_NOT_ACCEPTABLE;
> > #ifdef NO_RECOVERY
> > @@ -704,12 +710,6 @@
> > #endif
> > return NULL;
> > }
> > -
> > -#ifdef _WINDOWS_NSL
> > - strncpy(host, str, (size_t)512);
> > -#else
> > - host = str;
> > -#endif /* _WINDOWS_NSL */
>
Klaus