diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-05-17 03:14:57 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-05-17 03:14:57 +0000 |
commit | abbb73d0893e2daf4a06339f581cbe7dc752260f (patch) | |
tree | 8ba7c7d4bd67438218a8d4d9496e6ad8a6124041 | |
parent | 6ef3964c793f22dcbbfdac106cd5ead67a26bc2a (diff) |
- markus@cvs.openbsd.org 2001/05/12 19:53:13
[sftp-server.c]
readlink does not NULL-terminate; mhe@home.se
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | sftp-server.c | 7 |
2 files changed, 11 insertions, 4 deletions
@@ -1,3 +1,9 @@ | |||
1 | 20010517 | ||
2 | - OpenBSD CVS Sync | ||
3 | - markus@cvs.openbsd.org 2001/05/12 19:53:13 | ||
4 | [sftp-server.c] | ||
5 | readlink does not NULL-terminate; mhe@home.se | ||
6 | |||
1 | 20010512 | 7 | 20010512 |
2 | - OpenBSD CVS Sync | 8 | - OpenBSD CVS Sync |
3 | - markus@cvs.openbsd.org 2001/05/11 14:59:56 | 9 | - markus@cvs.openbsd.org 2001/05/11 14:59:56 |
@@ -5402,4 +5408,4 @@ | |||
5402 | - Wrote replacements for strlcpy and mkdtemp | 5408 | - Wrote replacements for strlcpy and mkdtemp |
5403 | - Released 1.0pre1 | 5409 | - Released 1.0pre1 |
5404 | 5410 | ||
5405 | $Id: ChangeLog,v 1.1218 2001/05/12 16:50:50 mouring Exp $ | 5411 | $Id: ChangeLog,v 1.1219 2001/05/17 03:14:57 mouring Exp $ |
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" |
25 | RCSID("$OpenBSD: sftp-server.c,v 1.25 2001/04/05 10:42:53 markus Exp $"); | 25 | RCSID("$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 | |||
883 | process_readlink(void) | 883 | process_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); |