瀏覽代碼

HPCC-16518 Fix potentially hitting asserts in UDP/SNMP reports

1) An assert could have been hit in the UDP stats reporter if the
"drops" column heading was not found.
2) In the SNMP stats reporter, if the "InErrors" column heading
was not found, it could in theory hit an assert when trying to
find the data entry.

In reality, I don't think either case could actually be hit.

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 8 年之前
父節點
當前提交
512e982798
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      system/jlib/jdebug.cpp

+ 4 - 2
system/jlib/jdebug.cpp

@@ -2170,8 +2170,8 @@ public:
             {
                 unsigned queue = strtoul(cols.item(queueCol), NULL, 16);
                 unsigned drops = 0;
-                if (dropsCol)
-                    drops =  strtoul(cols.item(dropsCol), NULL, 10);
+                if (dropsCol >= 0)
+                    drops = strtoul(cols.item(dropsCol), NULL, 10);
                 if (queue || drops)
                 {
                     unsigned port = strtoul(cols.item(portCol), NULL, 16);
@@ -2243,6 +2243,8 @@ public:
                         if (streq(columnNames.item(idx), "InErrors"))
                             inErrorsCol = idx;
                     }
+                    if (inErrorsCol == -1)
+                        break;
                 }
                 if (fgets(ln, sizeof(ln), netfp))
                 {