diff options
author | Colin Watson <cjwatson@debian.org> | 2006-05-12 08:53:37 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2006-05-12 08:53:37 +0000 |
commit | 2ee73b36b9a35daeaa4b065046882dc1f5f551b6 (patch) | |
tree | f64a4ace625514e94759878c0b94ab0a79805bbd /sftp-server.c | |
parent | 3c190ec8e469477ea65fbf4cc83062c65c281434 (diff) | |
parent | 3e2e0ac10674d77618c4c7339e18b83ced247492 (diff) |
Merge 4.3p2 to the trunk.
Diffstat (limited to 'sftp-server.c')
-rw-r--r-- | sftp-server.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sftp-server.c b/sftp-server.c index 6870e7732..7060c44ad 100644 --- a/sftp-server.c +++ b/sftp-server.c | |||
@@ -14,13 +14,14 @@ | |||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$OpenBSD: sftp-server.c,v 1.48 2005/06/17 02:44:33 djm Exp $"); | 17 | RCSID("$OpenBSD: sftp-server.c,v 1.50 2006/01/02 01:20:31 djm Exp $"); |
18 | 18 | ||
19 | #include "buffer.h" | 19 | #include "buffer.h" |
20 | #include "bufaux.h" | 20 | #include "bufaux.h" |
21 | #include "getput.h" | 21 | #include "getput.h" |
22 | #include "log.h" | 22 | #include "log.h" |
23 | #include "xmalloc.h" | 23 | #include "xmalloc.h" |
24 | #include "misc.h" | ||
24 | 25 | ||
25 | #include "sftp.h" | 26 | #include "sftp.h" |
26 | #include "sftp-common.h" | 27 | #include "sftp-common.h" |
@@ -427,7 +428,7 @@ process_read(void) | |||
427 | len = get_int(); | 428 | len = get_int(); |
428 | 429 | ||
429 | TRACE("read id %u handle %d off %llu len %d", id, handle, | 430 | TRACE("read id %u handle %d off %llu len %d", id, handle, |
430 | (u_int64_t)off, len); | 431 | (unsigned long long)off, len); |
431 | if (len > sizeof buf) { | 432 | if (len > sizeof buf) { |
432 | len = sizeof buf; | 433 | len = sizeof buf; |
433 | logit("read change len %d", len); | 434 | logit("read change len %d", len); |
@@ -468,7 +469,7 @@ process_write(void) | |||
468 | data = get_string(&len); | 469 | data = get_string(&len); |
469 | 470 | ||
470 | TRACE("write id %u handle %d off %llu len %d", id, handle, | 471 | TRACE("write id %u handle %d off %llu len %d", id, handle, |
471 | (u_int64_t)off, len); | 472 | (unsigned long long)off, len); |
472 | fd = handle_to_fd(handle); | 473 | fd = handle_to_fd(handle); |
473 | if (fd >= 0) { | 474 | if (fd >= 0) { |
474 | if (lseek(fd, off, SEEK_SET) < 0) { | 475 | if (lseek(fd, off, SEEK_SET) < 0) { |
@@ -945,7 +946,7 @@ process(void) | |||
945 | return; /* Incomplete message. */ | 946 | return; /* Incomplete message. */ |
946 | cp = buffer_ptr(&iqueue); | 947 | cp = buffer_ptr(&iqueue); |
947 | msg_len = GET_32BIT(cp); | 948 | msg_len = GET_32BIT(cp); |
948 | if (msg_len > 256 * 1024) { | 949 | if (msg_len > SFTP_MAX_MSG_LENGTH) { |
949 | error("bad message "); | 950 | error("bad message "); |
950 | exit(11); | 951 | exit(11); |
951 | } | 952 | } |
@@ -1036,6 +1037,9 @@ main(int ac, char **av) | |||
1036 | int in, out, max; | 1037 | int in, out, max; |
1037 | ssize_t len, olen, set_size; | 1038 | ssize_t len, olen, set_size; |
1038 | 1039 | ||
1040 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ | ||
1041 | sanitise_stdfd(); | ||
1042 | |||
1039 | /* XXX should use getopt */ | 1043 | /* XXX should use getopt */ |
1040 | 1044 | ||
1041 | __progname = ssh_get_progname(av[0]); | 1045 | __progname = ssh_get_progname(av[0]); |