git.annexia.org
/
libguestfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
533aff2
)
pread: Check count and offset parameters are not negative.
author
Richard W.M. Jones
<rjones@redhat.com>
Mon, 27 Sep 2010 09:51:38 +0000
(10:51 +0100)
committer
Richard W.M. Jones
<rjones@redhat.com>
Mon, 27 Sep 2010 09:51:38 +0000
(10:51 +0100)
daemon/file.c
patch
|
blob
|
history
diff --git
a/daemon/file.c
b/daemon/file.c
index
9403100
..
5bc5f41
100644
(file)
--- a/
daemon/file.c
+++ b/
daemon/file.c
@@
-415,6
+415,16
@@
do_pread (const char *path, int count, int64_t offset, size_t *size_r)
ssize_t r;
char *buf;
+ if (count < 0) {
+ reply_with_error ("count is negative");
+ return NULL;
+ }
+
+ if (offset < 0) {
+ reply_with_error ("offset is negative");
+ return NULL;
+ }
+
/* The actual limit on messages is smaller than this. This check
* just limits the amount of memory we'll try and allocate in the
* function. If the message is larger than the real limit, that