浏览代码

HPCC-14888 GetRFCText array bounds check

Signed-off-by: Mark Kelly <mark.kelly@lexisnexis.com>
Mark Kelly 9 年之前
父节点
当前提交
b664836952
共有 1 个文件被更改,包括 6 次插入1 次删除
  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[] =