pwrite: Check offset is not negative.

This commit is contained in:
Richard W.M. Jones
2010-09-26 17:59:50 +01:00
parent 406dbf7565
commit 5a8c8b8bf6

View File

@@ -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;