summaryrefslogtreecommitdiff
path: root/sftp-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'sftp-server.c')
-rw-r--r--sftp-server.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sftp-server.c b/sftp-server.c
index 75c19c8a6..1cbd1847c 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -22,7 +22,7 @@
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24#include "includes.h" 24#include "includes.h"
25RCSID("$OpenBSD: sftp-server.c,v 1.25 2001/04/05 10:42:53 markus Exp $"); 25RCSID("$OpenBSD: sftp-server.c,v 1.26 2001/05/12 19:53:13 markus Exp $");
26 26
27#include "buffer.h" 27#include "buffer.h"
28#include "bufaux.h" 28#include "bufaux.h"
@@ -883,18 +883,19 @@ void
883process_readlink(void) 883process_readlink(void)
884{ 884{
885 u_int32_t id; 885 u_int32_t id;
886 int len;
886 char link[MAXPATHLEN]; 887 char link[MAXPATHLEN];
887 char *path; 888 char *path;
888 889
889 id = get_int(); 890 id = get_int();
890 path = get_string(NULL); 891 path = get_string(NULL);
891 TRACE("readlink id %d path %s", id, path); 892 TRACE("readlink id %d path %s", id, path);
892 if (readlink(path, link, sizeof(link) - 1) == -1) 893 if ((len = readlink(path, link, sizeof(link) - 1)) == -1)
893 send_status(id, errno_to_portable(errno)); 894 send_status(id, errno_to_portable(errno));
894 else { 895 else {
895 Stat s; 896 Stat s;
896 897
897 link[sizeof(link) - 1] = '\0'; 898 link[len] = '\0';
898 attrib_clear(&s.attrib); 899 attrib_clear(&s.attrib);
899 s.name = s.long_name = link; 900 s.name = s.long_name = link;
900 send_names(id, 1, &s); 901 send_names(id, 1, &s);