Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* strange errors with strncpy ( redhat Vanderbilt )
@ 1997-01-03 20:32 Zarmfab Software Development
  0 siblings, 0 replies; 2+ messages in thread
From: Zarmfab Software Development @ 1997-01-03 20:32 UTC (permalink / raw)


Just installed the wu-ftpd from the axp-devel-tree, and noticed that it's still
buggy ( the patch i posted some weeks ago haven't got in ;-( ). No Problem, i found
the patch in my private mail archive, recompiled and tested the daemon.

Everything looked  fine at the first glance, but then i noticed that the message
that is displayed if an anonymouns user doesn't supply the recommended password
misses the hostname.

230-The response '' is not valid
230-Next time please use your e-mail address as your password
230-        for example: joe@
                                       ^^^^^^^^^^^^^^^^^^^^^^^^

Looking at the source, i found the following fragment in file ftpd.c, function
dolog() :

>     hp = gethostbyaddr((char *)&sin->sin_addr, sizeof(struct in_addr), AF_INET);
>    ....
>         if (hp) {
>             nameserved = 1;
>             (void) strncpy(remotehost, hp->h_name, sizeof(remotehost));
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

inserting some syslog-directives i found that strncpy obviously fails here,
hp->h_name contains the correct name of the connected peer.

remotehost is defined globally, so i
defined a local  char dummy[64] inside dolog(), first strncpy'd from hp->h_name
to dummy, and then strncpy'd from dummy to remotehost, and the code 
worked -- somewhat strange isn't it ?

Another test was to link ftpd with my own, c-coded strncpy, this also works.

i tried to reproduce the error with some small test programs, but they all
worked fine.

Could this be a compiler or (dynamic) linker bug ?

Anyway, the daemon is running now, you'll find my old patch to ftpd as:
ftp://fabserver1.zarm.uni-bremen.de/pub/axp/ftpd.patch

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: strange errors with strncpy ( redhat Vanderbilt )
       [not found] <199701032032.VAA01470@fabsoft2.zarm.uni-bremen.de>
@ 1997-01-04 20:21 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 1997-01-04 20:21 UTC (permalink / raw)


> i tried to reproduce the error with some small test programs, but they all
> worked fine.
> 
> Could this be a compiler or (dynamic) linker bug ?

No, it is a subtle bug in strncpy that I've yet to be able to 
reproduce outside some large program.  I've taken the simple
step of having Erik disable the assembly version in the latest
glibc RPM.

r~

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-01-04 20:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-01-03 20:32 strange errors with strncpy ( redhat Vanderbilt ) Zarmfab Software Development
     [not found] <199701032032.VAA01470@fabsoft2.zarm.uni-bremen.de>
1997-01-04 20:21 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox