diff options
author | Marcus Brinkmann <marcus@gnu.org> | 2002-05-23 21:24:18 +0000 |
---|---|---|
committer | Marcus Brinkmann <marcus@gnu.org> | 2002-05-23 21:24:18 +0000 |
commit | ecc17687614c8502a055166758758942622814c9 (patch) | |
tree | 719531bdf07b439044e672b4f23bf562068387a7 | |
parent | 03969ed20237d7a2a0b1fdd166fa17727b918ac0 (diff) |
2002-05-23 Marcus Brinkmann <marcus@gnu.org>
* 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.
-rw-r--r-- | libnetfs/ChangeLog | 7 | ||||
-rw-r--r-- | 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 <marcus@gnu.org> + + * 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 <roland@frob.com> * 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. */ |