From 747ffa12f6e946e33f04958ea953c3b0ed5b281c Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 10 Jan 2006 10:54:38 +0000 Subject: fix --- sshfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sshfs.c b/sshfs.c index c4d6fc4..ab0c1e1 100644 --- a/sshfs.c +++ b/sshfs.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -1149,6 +1150,8 @@ static int sshfs_readlink(const char *path, char *linkbuf, size_t size) struct buffer buf; struct buffer name; + assert(size > 0); + if (sshfs.server_version < 3) return -EPERM; @@ -1160,7 +1163,7 @@ static int sshfs_readlink(const char *path, char *linkbuf, size_t size) char *link; err = -EIO; if(buf_get_uint32(&name, &count) != -1 && count == 1 && - buf_get_string(&name, &link) != -1 && size > 0) { + buf_get_string(&name, &link) != -1) { if (link[0] == '/' && sshfs.symlink_prefix_len) { size_t len = sshfs.symlink_prefix_len; if (len > size - 1) -- cgit v1.2.3