Skip to content

Commit b008db3

Browse files
ashwanthgolijeschkies
authored andcommitted
fix: remove usage of unsafe string in label adapter unmarshal (grafana#14216)
1 parent 2bbab55 commit b008db3

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ require (
124124
github.com/fsnotify/fsnotify v1.7.0
125125
github.com/gogo/googleapis v1.4.1
126126
github.com/grafana/jsonparser v0.0.0-20240425183733-ea80629e1a32
127-
github.com/grafana/loki/pkg/push v0.0.0-20231124142027-e52380921608
127+
github.com/grafana/loki/pkg/push v0.0.0-20240923094301-8ebb2b5300f0
128128
github.com/hashicorp/golang-lru/v2 v2.0.7
129129
github.com/hashicorp/raft v1.7.1
130130
github.com/hashicorp/raft-wal v0.4.1

pkg/push/types.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,6 @@ func (m *Entry) Unmarshal(dAtA []byte) error {
571571
}
572572

573573
// Unmarshal a LabelAdapter, implements proto.Unmarshaller.
574-
// NB this is a copy of the autogenerated code to unmarshal a LabelPair,
575-
// with the byte copying replaced with a yoloString.
576574
func (m *LabelAdapter) Unmarshal(dAtA []byte) error {
577575
l := len(dAtA)
578576
iNdEx := 0
@@ -632,7 +630,7 @@ func (m *LabelAdapter) Unmarshal(dAtA []byte) error {
632630
if postIndex > l {
633631
return io.ErrUnexpectedEOF
634632
}
635-
m.Name = yoloString(dAtA[iNdEx:postIndex])
633+
m.Name = string(dAtA[iNdEx:postIndex])
636634
iNdEx = postIndex
637635
case 2:
638636
if wireType != 2 {
@@ -664,7 +662,7 @@ func (m *LabelAdapter) Unmarshal(dAtA []byte) error {
664662
if postIndex > l {
665663
return io.ErrUnexpectedEOF
666664
}
667-
m.Value = yoloString(dAtA[iNdEx:postIndex])
665+
m.Value = string(dAtA[iNdEx:postIndex])
668666
iNdEx = postIndex
669667
default:
670668
iNdEx = preIndex

vendor/github.com/grafana/loki/pkg/push/types.go

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ github.com/grafana/gomemcache/memcache
10341034
# github.com/grafana/jsonparser v0.0.0-20240425183733-ea80629e1a32
10351035
## explicit; go 1.13
10361036
github.com/grafana/jsonparser
1037-
# github.com/grafana/loki/pkg/push v0.0.0-20231124142027-e52380921608 => ./pkg/push
1037+
# github.com/grafana/loki/pkg/push v0.0.0-20240923094301-8ebb2b5300f0 => ./pkg/push
10381038
## explicit; go 1.19
10391039
github.com/grafana/loki/pkg/push
10401040
# github.com/grafana/pyroscope-go/godeltaprof v0.1.8

0 commit comments

Comments
 (0)