From ecc17687614c8502a055166758758942622814c9 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 23 May 2002 21:24:18 +0000 Subject: 2002-05-23 Marcus Brinkmann * io-read.c (netfs_S_io_read): If desired amount is larger than symlink length, truncate amount. Actually use WHOLE_LINK to store link target temporarily. When reading the link target directly, update *DATALEN. --- libnetfs/ChangeLog | 7 +++++++ libnetfs/io-read.c | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libnetfs/ChangeLog b/libnetfs/ChangeLog index c1dbb120..20f60e53 100644 --- a/libnetfs/ChangeLog +++ b/libnetfs/ChangeLog @@ -1,3 +1,10 @@ +2002-05-23 Marcus Brinkmann + + * io-read.c (netfs_S_io_read): If desired amount is larger than + symlink length, truncate amount. Actually use WHOLE_LINK to store + link target temporarily. When reading the link target directly, + update *DATALEN. + 2002-05-13 Roland McGrath * netfs.h (struct node): New member `nn_translated'. diff --git a/libnetfs/io-read.c b/libnetfs/io-read.c index a4b1b2e2..ff8fbcff 100644 --- a/libnetfs/io-read.c +++ b/libnetfs/io-read.c @@ -65,6 +65,8 @@ netfs_S_io_read (struct protid *user, if (start + amount > size) amount = size - start; + if (amount > size) + amount = size; if (start >= size) { @@ -74,7 +76,7 @@ netfs_S_io_read (struct protid *user, else if (amount < size || start > 0) { char *whole_link = alloca (size); - err = netfs_attempt_readlink (user->user, node, *data); + err = netfs_attempt_readlink (user->user, node, whole_link); if (! err) { memcpy (*data, whole_link + start, amount); @@ -82,7 +84,10 @@ netfs_S_io_read (struct protid *user, } } else - err = netfs_attempt_readlink (user->user, node, *data); + { + err = netfs_attempt_readlink (user->user, node, *data); + *datalen = amount; + } } else /* Read from a normal file. */ -- cgit v1.2.3