Преглед на файлове

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[] =