Browse Source

Merge pull request #8192 from mckellyln/hpcc-14888a

HPCC-14888 GetRFCText array bounds check

Reviewed-By: Jake Smith <jake.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 years ago
parent
commit
d2d7e29d9c
1 changed files with 6 additions and 1 deletions
  1. 6 1
      common/remote/sockfile.cpp

+ 6 - 1
common/remote/sockfile.cpp

@@ -360,7 +360,12 @@ const char *RFCStrings[] =
     RFCText(RFCsetfileperms),
     RFCText(RFCunknown),
 };
-static const char *getRFCText(RemoteFileCommandType cmd) { return RFCStrings[cmd]; }
+static const char *getRFCText(RemoteFileCommandType cmd)
+{
+    if (cmd > RFCmax)
+        cmd = RFCmax;
+    return RFCStrings[cmd];
+}
 
 #define ThrottleText(throttleClass) #throttleClass
 const char *ThrottleStrings[] =