aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-01-10 10:54:38 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2006-01-10 10:54:38 +0000
commit747ffa12f6e946e33f04958ea953c3b0ed5b281c (patch)
tree6cf49072f289ed7c8e7d1e4afbed843e88225b95
parentbad7f96bad143f46bd1207c093ec2c68fc1114fc (diff)
downloadsshfs-747ffa12f6e946e33f04958ea953c3b0ed5b281c.tar
sshfs-747ffa12f6e946e33f04958ea953c3b0ed5b281c.tar.gz
sshfs-747ffa12f6e946e33f04958ea953c3b0ed5b281c.tar.bz2
sshfs-747ffa12f6e946e33f04958ea953c3b0ed5b281c.zip
fix
-rw-r--r--sshfs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sshfs.c b/sshfs.c
index c4d6fc4..ab0c1e1 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -10,6 +10,7 @@
#include <fuse.h>
#include <fuse_opt.h>
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -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)