You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/03/11 16:42:40 UTC
[GitHub] [trafficcontrol] TaylorCFrey opened a new issue #5628: CDN-in-a-box enroller does not derefence string pointer
TaylorCFrey opened a new issue #5628:
URL: https://github.com/apache/trafficcontrol/issues/5628
## I'm submitting a ...
- bug report
## Traffic Control components affected ...
- CDN in a Box
## Current behavior:
Executing tests on the cdn-in-a-box directory revealed a missing derefence for a string pointer
```bash
cd <trafficcontrol_directory>/infrastructure/cdn-in-a-box
go test -v ./...
```
Which will return
```bash
# github.com/apache/trafficcontrol/infrastructure/cdn-in-a-box/enroller
enroller/enroller.go:487:4: Infof format %s has arg s.Name of wrong type *string
```
## Expected behavior:
Since there are no test files, executing `go test -v ./...` should return:
```bash
? github.com/apache/trafficcontrol/infrastructure/cdn-in-a-box/enroller [no test files]
```
## Minimal reproduction of the problem with instructions:
See steps under **_Current Behavior_**
## Anything else:
The enroller has the potential to hit a run time exception by attempting to format a *string instead of a string. The string variable will need to be checked if _nil_ and, if not, it will need to be derefenced:
```go
func enrollStatus(toSession *session, r io.Reader) error {
// ...
log.Infof("status %s already exists\n", s.Name)
// ...
}
```
A fix for the code might read something akin to:
```go
func enrollStatus(toSession *session, r io.Reader) error {
// ...
if s == nil {
temp := ""
s = &temp
}
log.Infof("status %s already exists\n", s.Name)
// ...
}
```
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 closed issue #5628: CDN-in-a-box enroller does not derefence string pointer
Posted by GitBox <gi...@apache.org>.
ocket8888 closed issue #5628:
URL: https://github.com/apache/trafficcontrol/issues/5628
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 closed issue #5628: CDN-in-a-box enroller does not derefence string pointer
Posted by GitBox <gi...@apache.org>.
ocket8888 closed issue #5628:
URL: https://github.com/apache/trafficcontrol/issues/5628
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org