diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2010-09-26 17:59:50 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2010-09-26 22:21:36 +0100 |
commit | 5a8c8b8bf6e846b8d2d7e710f814d24d9a0183c3 (patch) | |
tree | 385bb15252a351b8b10d32a23f8a6bf1feab92de /daemon/file.c | |
parent | 406dbf7565e702588f172a8cc534acacb2fd7bee (diff) | |
download | libguestfs-5a8c8b8bf6e846b8d2d7e710f814d24d9a0183c3.tar.gz libguestfs-5a8c8b8bf6e846b8d2d7e710f814d24d9a0183c3.tar.xz libguestfs-5a8c8b8bf6e846b8d2d7e710f814d24d9a0183c3.zip |
pwrite: Check offset is not negative.
Diffstat (limited to 'daemon/file.c')
-rw-r--r-- | daemon/file.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/daemon/file.c b/daemon/file.c index 476f4456..08494564 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -469,6 +469,11 @@ do_pwrite (const char *path, const char *content, size_t size, int64_t offset) int fd; ssize_t r; + if (offset < 0) { + reply_with_error ("offset is negative"); + return -1; + } + CHROOT_IN; fd = open (path, O_WRONLY); CHROOT_OUT; |