[Libguestfs] [PATCH 1/2] pwrite: Check offset is not negative.
Richard W.M. Jones
rjones at redhat.com
Sun Sep 26 18:54:28 UTC 2010
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-------------- next part --------------
>From 24d1ce5ed269a0d3b03565643b9958948a63e9c5 Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones at redhat.com>
Date: Sun, 26 Sep 2010 17:59:50 +0100
Subject: [PATCH 1/2] pwrite: Check offset is not negative.
---
daemon/file.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/daemon/file.c b/daemon/file.c
index 476f445..0849456 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;
--
1.7.3
More information about the Libguestfs
mailing list