You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2018/11/08 16:25:55 UTC
[trafficcontrol] branch master updated: Fixes a bug in the compare
tool where short lines would cause a segfault
This is an automated email from the ASF dual-hosted git repository.
mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new eb99b3a Fixes a bug in the compare tool where short lines would cause a segfault
eb99b3a is described below
commit eb99b3af27fb89cba1e533375912cfd80d4b7f1b
Author: ocket8888 <oc...@gmail.com>
AuthorDate: Wed Nov 7 08:40:26 2018 -0700
Fixes a bug in the compare tool where short lines would cause a segfault
---
traffic_ops/testing/compare/compare.go | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/traffic_ops/testing/compare/compare.go b/traffic_ops/testing/compare/compare.go
index 1f38871..9ed530d 100644
--- a/traffic_ops/testing/compare/compare.go
+++ b/traffic_ops/testing/compare/compare.go
@@ -162,10 +162,11 @@ func testRoute(tos []*Connect, route string) {
log.Print(" and ", p)
}
+
refResult = ""
testResult = ""
- for i, refLine := range refLines {
+ for _, refLine := range refLines {
if len(refLine) < len(SHORT_HEADER) {
refResult += refLine
} else if refLine[:len(SHORT_HEADER)] != SHORT_HEADER {
@@ -177,16 +178,18 @@ func testRoute(tos []*Connect, route string) {
refResult += refLine
}
}
+ }
- if len(testLines[i]) < len(SHORT_HEADER) {
- testResult += testLines[i]
- } else if testLines[i][:len(SHORT_HEADER)] != SHORT_HEADER {
- if len(testLines[i]) >= len(LONG_HEADER) {
- if testLines[i][:len(LONG_HEADER)] != LONG_HEADER {
- testResult += testLines[i]
+ for _, testLine := range testLines {
+ if len(testLine) < len(SHORT_HEADER) {
+ testResult += testLine
+ } else if testLine[:len(SHORT_HEADER)] != SHORT_HEADER {
+ if len(testLine) >= len(LONG_HEADER) {
+ if testLine[:len(LONG_HEADER)] != LONG_HEADER {
+ testResult += testLine
}
} else {
- testResult += testLines[i]
+ testResult += testLine
}
}
}