]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-windows-pioctl-buffer-overrun-20070609
authorAsanka Herath <asanka@secure-endpoints.com>
Sun, 10 Jun 2007 06:54:10 +0000 (06:54 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 10 Jun 2007 06:54:10 +0000 (06:54 +0000)
this patch protects against a buffer overrun in the client if the
server were to send more data than the receiving buffer can hold.

(cherry picked from commit 8a814a5596e9d8db1c24326715f794ae46966b3b)

src/sys/pioctl_nt.c

index 7dc238d51182af0df6356b927eb2bdb9b3c71407..3a3f83ea40259773fae567382411e99794f82853 100644 (file)
@@ -844,6 +844,10 @@ pioctl(char *pathp, long opcode, struct ViceIoctl *blobp, int follow)
 
     MarshallString(&preq, fullPath);
     if (blobp->in_size) {
+        if (blobp->in_size > sizeof(preq.data) - (preq.mp - preq.data)*sizeof(char)) {
+            errno = E2BIG;
+            return -1;
+        }
        memcpy(preq.mp, blobp->in, blobp->in_size);
        preq.mp += blobp->in_size;
     }