Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
0aff6873
Commit
0aff6873
authored
Oct 28, 2014
by
Brian Tiger Chow
Committed by
Juan Batiz-Benet
Nov 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(peer) perform bounds check on peer Id when printing String
parent
0c530bf5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
peer/peer.go
peer/peer.go
+6
-1
No files found.
peer/peer.go
View file @
0aff6873
...
@@ -116,7 +116,12 @@ type peer struct {
...
@@ -116,7 +116,12 @@ type peer struct {
// String prints out the peer.
// String prints out the peer.
func
(
p
*
peer
)
String
()
string
{
func
(
p
*
peer
)
String
()
string
{
return
"[Peer "
+
p
.
id
.
String
()[
:
12
]
+
"]"
pid
:=
p
.
id
.
String
()
maxRunes
:=
12
if
len
(
pid
)
<
maxRunes
{
maxRunes
=
len
(
pid
)
}
return
"[Peer "
+
pid
[
:
maxRunes
]
+
"]"
}
}
// Key returns the ID as a Key (string) for maps.
// Key returns the ID as a Key (string) for maps.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment