Skip to content

Commit 8f1aa7a

Browse files
kylos101ona-agent
andcommitted
Revert "Don't get fooled by the match"
This reverts commit 124b7ac. Co-authored-by: Ona <[email protected]>
1 parent 124b7ac commit 8f1aa7a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

components/ee/agent-smith/pkg/classifier/sinature.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,6 @@ func (s *Signature) matchTextFile(in *SignatureReadCache) (bool, error) {
313313
pos := s.Slice.Start
314314
for {
315315
n, err := in.Reader.ReadAt(buffer, pos)
316-
if err == io.EOF {
317-
break
318-
}
319-
if err != nil {
320-
return false, xerrors.Errorf("cannot read stream: %w", err)
321-
}
322316
sub := buffer[0:n]
323317
pos += int64(n)
324318

@@ -329,6 +323,13 @@ func (s *Signature) matchTextFile(in *SignatureReadCache) (bool, error) {
329323
if match {
330324
return true, nil
331325
}
326+
327+
if err == io.EOF {
328+
break
329+
}
330+
if err != nil {
331+
return false, xerrors.Errorf("cannot read stream: %w", err)
332+
}
332333
if s.Slice.End > 0 && pos >= s.Slice.End {
333334
break
334335
}

0 commit comments

Comments
 (0)