[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 01/26: Check for negative sizes in file_set_size
From: |
Samuel Thibault |
Subject: |
[hurd] 01/26: Check for negative sizes in file_set_size |
Date: |
Sat, 02 Nov 2013 14:44:43 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 6c3825f2b750bf9b913c6ea986739e648c470603
Author: Richard Braun <address@hidden>
Date: Wed Oct 2 20:30:15 2013 +0200
Check for negative sizes in file_set_size
* libdiskfs/file-set-size.c (diskfs_S_file_set_size): Return EINVAL if
size is negative.
* libnetfs/file-set-size.c (netfs_S_file_set_size): Likewise.
* libtreefs/s-file.c (treefs_S_file_set_size): Likewise.
* storeio/io.c (trivfs_S_file_set_size): Likewise.
* term/users.c (trivfs_S_file_set_size): Likewise.
* trans/null.c (trivfs_S_file_set_size): Likewise.
* trans/streamio.c (trivfs_S_file_set_size): Likewise.
---
libdiskfs/file-set-size.c | 2 +-
libnetfs/file-set-size.c | 2 ++
libtreefs/s-file.c | 2 ++
storeio/io.c | 2 ++
term/users.c | 2 ++
trans/null.c | 2 ++
trans/streamio.c | 2 ++
7 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/libdiskfs/file-set-size.c b/libdiskfs/file-set-size.c
index 18abb46..fe2125a 100644
--- a/libdiskfs/file-set-size.c
+++ b/libdiskfs/file-set-size.c
@@ -26,7 +26,7 @@ diskfs_S_file_set_size (struct protid *cred,
{
CHANGE_NODE_FIELD (cred,
({
- if (!(cred->po->openstat & O_WRITE))
+ if (!(cred->po->openstat & O_WRITE) || (size < 0))
err = EINVAL;
else if (size < np->dn_stat.st_size)
{
diff --git a/libnetfs/file-set-size.c b/libnetfs/file-set-size.c
index 72f31db..b4a8cd2 100644
--- a/libnetfs/file-set-size.c
+++ b/libnetfs/file-set-size.c
@@ -29,6 +29,8 @@ netfs_S_file_set_size (struct protid *user,
if (!user)
return EOPNOTSUPP;
+ else if (size < 0)
+ return EINVAL;
pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_set_size (user->user, user->po->np, size);
diff --git a/libtreefs/s-file.c b/libtreefs/s-file.c
index 73c32d7..c24d645 100644
--- a/libtreefs/s-file.c
+++ b/libtreefs/s-file.c
@@ -220,6 +220,8 @@ treefs_S_file_set_size (struct treefs_protid *cred, off_t
size)
{
if (!cred)
return EOPNOTSUPP;
+ else if (size < 0)
+ return EINVAL;
return treefs_s_file_set_size (cred, size);
}
diff --git a/storeio/io.c b/storeio/io.c
index c79f6ba..eaa20de 100644
--- a/storeio/io.c
+++ b/storeio/io.c
@@ -178,6 +178,8 @@ trivfs_S_file_set_size (struct trivfs_protid *cred,
{
if (! cred)
return EOPNOTSUPP;
+ else if (size < 0)
+ return EINVAL;
else
return 0;
}
diff --git a/term/users.c b/term/users.c
index 9d745c6..eacd150 100644
--- a/term/users.c
+++ b/term/users.c
@@ -1808,6 +1808,8 @@ trivfs_S_file_set_size (struct trivfs_protid *cred,
{
if (!cred)
return EOPNOTSUPP;
+ else if (size < 0)
+ return EINVAL;
pthread_mutex_lock (&global_lock);
if ((cred->po->openmodes & O_WRITE) == 0)
{
diff --git a/trans/null.c b/trans/null.c
index 8b3b4e0..4828cce 100644
--- a/trans/null.c
+++ b/trans/null.c
@@ -245,6 +245,8 @@ trivfs_S_file_set_size (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t replytype,
loff_t size)
{
+ if (size < 0)
+ return EINVAL;
return 0;
}
diff --git a/trans/streamio.c b/trans/streamio.c
index 8ff3dc6..68badd2 100644
--- a/trans/streamio.c
+++ b/trans/streamio.c
@@ -625,6 +625,8 @@ trivfs_S_file_set_size (struct trivfs_protid *cred,
return EOPNOTSUPP;
else if (!(cred->po->openmodes & O_WRITE))
return EBADF;
+ else if (size < 0)
+ return EINVAL;
else
return 0;
}
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] branch upstream updated (223b7da -> 90b039d), Samuel Thibault, 2013/11/02
- [hurd] 01/26: Check for negative sizes in file_set_size,
Samuel Thibault <=
- [hurd] 03/26: Fix memory leak in exec, Samuel Thibault, 2013/11/02
- [hurd] 02/26: Fix memory leak in libnetfs, Samuel Thibault, 2013/11/02
- [hurd] 10/26: console-client: minor stylistic fix, Samuel Thibault, 2013/11/02
- [hurd] 04/26: Revert "tmpfs: drop privileges in the tmpfs translator", Samuel Thibault, 2013/11/02
- [hurd] 26/26: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2013/11/02
- [hurd] 09/26: console-client: fix error handling, Samuel Thibault, 2013/11/02
- [hurd] 11/26: console-client: replace function epilogue with console_exit, Samuel Thibault, 2013/11/02
- [hurd] 24/26: Fix use after free, Samuel Thibault, 2013/11/02
- [hurd] 12/26: term: fix read on a closed PTY, Samuel Thibault, 2013/11/02
- [hurd] 23/26: libshouldbeinlibc: fix error handling in maptime_map, Samuel Thibault, 2013/11/02