aboutsummaryrefslogtreecommitdiff
path: root/procfs
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-01 13:52:24 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-01 14:04:51 +0100
commitc458a7f5aeaf9f5ce0c72d97b21e0eec2b9b145a (patch)
tree1b6b9bbaeb93913a8077bdcba0e91152b704138e /procfs
parent851d51c14cf11e77db8b0e4acd1360b3c6de793a (diff)
downloadhurd-c458a7f5aeaf9f5ce0c72d97b21e0eec2b9b145a.tar.gz
hurd-c458a7f5aeaf9f5ce0c72d97b21e0eec2b9b145a.tar.bz2
hurd-c458a7f5aeaf9f5ce0c72d97b21e0eec2b9b145a.zip
procfs: Fix checking underrun
Diffstat (limited to 'procfs')
-rw-r--r--procfs/netfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/procfs/netfs.c b/procfs/netfs.c
index f68435d4..20238386 100644
--- a/procfs/netfs.c
+++ b/procfs/netfs.c
@@ -87,11 +87,11 @@ error_t netfs_attempt_read (struct iouser *cred, struct node *np,
contents += offset;
contents_len -= offset;
+ if (contents_len < 0)
+ contents_len = 0;
if (*len > contents_len)
*len = contents_len;
- if (*len < 0)
- *len = 0;
memcpy (data, contents, *len);
return 0;