Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Zarmfab Software Development <fabsoft@fabsoft2.zarm.uni-bremen.de>
Subject: strange errors with strncpy ( redhat Vanderbilt )
Date: Fri, 3 Jan 1997 21:32:07 +0100 (MET)	[thread overview]
Message-ID: <d2a61a94248539e6d31be45caff091fb.axp-list@archive.invalid> (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

             reply	other threads:[~1997-01-03 20:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-03 20:32 Zarmfab Software Development [this message]
     [not found] <199701032032.VAA01470@fabsoft2.zarm.uni-bremen.de>
1997-01-04 20:21 ` strange errors with strncpy ( redhat Vanderbilt ) Richard Henderson
read-only archive

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