From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: X-Archive-Original-Message-ID: <199701032032.VAA01470@fabsoft2.zarm.uni-bremen.de> Date: Fri, 3 Jan 1997 21:32:07 +0100 (MET) From: Zarmfab Software Development Subject: strange errors with strncpy ( redhat Vanderbilt ) 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