OPENAFS-SA-2018-003 volser: prevent unbounded input to various AFSVol* RPCs
[openafs.git] / src / volser / volint.xg
index 9ce8b6f..3c982e5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
@@ -65,6 +65,7 @@ statindex 16
 %#define     VOLDUMPV2_OMITDIRS 1
 
 const SIZE = 1024;
+const NMAXNSERVERS = 13;
 
 struct volser_status {
        afs_uint32 volID;               /* Volume id--unique over all systems */
@@ -210,9 +211,10 @@ struct pIDs {
 };
 
 struct diskPartition {
-        char   name[32];       /* Mounted partition name */
-        char   devName[32];    
-        int    lock_fd;
+       char    name[32];       /* Mounted partition name */
+       char    devName[32];
+       int     lock_fd;        /* assigned from DiskPartition FD_t
+                                   which is 64-bit HANDLE on Windows */
        int     totalUsable;
        int     free;
        int     minFree;
@@ -220,13 +222,13 @@ struct diskPartition {
 };
 
 struct diskPartition64 {
-    char       name[256];      /* Mounted partition name */
-    char       devName[256];   
-    int                lock_fd;
-    afs_int64  totalUsable;
-    afs_int64  free;
-    afs_int64  minFree;
-
+        char           name[256];      /* Mounted partition name */
+        char           devName[256];
+        int            lock_fd;        /* assigned from DiskPartition64 FD_t
+                                           which is a 64-bit HANDLE on Windows */
+        afs_int64      totalUsable;
+        afs_int64      free;
+        afs_int64      minFree;
 };
 
 struct restoreCookie {
@@ -246,7 +248,7 @@ struct volintSize {
     afs_uint64 dump_size;
 };
 
-typedef  replica manyDests<>;
+typedef  replica manyDests<NMAXNSERVERS>;
 typedef  afs_int32 manyResults<>;
 typedef  transDebugInfo transDebugEntries<>;
 typedef  volintInfo volEntries<>;
@@ -255,7 +257,7 @@ typedef  volintXInfo volXEntries<>;
 
 proc CreateVolume(
   IN afs_int32 partition,
-  string name<>,
+  string name<VNAMESIZE>,
   IN afs_int32 type,
   IN afs_uint32 parent,
   INOUT afs_uint32 *volid,
@@ -289,7 +291,7 @@ proc Clone(
   IN afs_int32 trans,
   IN afs_uint32 purgeVol,
   IN afs_int32 newType,
-  IN string newName<>,
+  IN string newName<VNAMESIZE>,
   INOUT afs_uint32 *newVol
 ) = VOLCLONE;
 
@@ -337,7 +339,7 @@ proc GetStatus(
 ) = VOLGETSTATUS;
 
 proc SignalRestore(
-  IN string name<>,
+  IN string name<VNAMESIZE>,
   int type,
   afs_uint32 pid,
   afs_uint32 cloneid
@@ -355,7 +357,7 @@ proc ListVolumes(
 
 proc SetIdsTypes(
   IN afs_int32 tId,
-  string name<>,
+  string name<VNAMESIZE>,
   afs_int32 type,
   afs_uint32 pId,
   afs_uint32 cloneId,
@@ -367,7 +369,7 @@ proc Monitor(
 ) = VOLMONITOR;
 
 proc PartitionInfo(
-  IN string name<>,
+  IN string name<4096>,
   OUT struct diskPartition *partition
 ) = VOLDISKPART;
 
@@ -440,13 +442,13 @@ proc DumpV2(
 ) split = VOLDUMPV2;
 
 proc PartitionInfo64(
-    IN string name<>,
+    IN string name<4096>,
     OUT struct diskPartition64 *partition
 ) = VOLDISKPART64;
 
 proc SplitVolume (
   IN afs_uint32 vid,
-  IN afs_uint32 new,
+  IN afs_uint32 newid,
   IN afs_uint32 where,
   IN afs_int32 verbose
 ) split = VOLSPLIT;