Page MenuHomeFreeBSD

Fix multiple bugs in cam_strmatch
ClosedPublic

Authored by asomers on Nov 20 2017, 9:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 14, 5:27 PM
Unknown Object (File)
Mar 22 2024, 10:32 PM
Unknown Object (File)
Mar 22 2024, 10:32 PM
Unknown Object (File)
Mar 22 2024, 10:32 PM
Unknown Object (File)
Mar 8 2024, 7:10 AM
Unknown Object (File)
Feb 27 2024, 1:01 AM
Unknown Object (File)
Jan 29 2024, 8:16 PM
Unknown Object (File)
Jan 21 2024, 4:05 AM
Subscribers

Details

Summary

Fix multiple bugs in cam_strmatch

  • Wrongly matches strings that are shorter than the pattern
  • Fails to match negative character sets
  • Fails to match character sets that aren't at the end of the pattern
  • Fails to match character ranges
Test Plan

Added unit tests

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I suspect these same bugs are present in the file globbing code I stole the original implementation from.
Nice catches.

lib/libcam/tests/cam_test.c
91 โ†—(On Diff #35505)

There's no pattern like 'fo[a-z][a-z][123]' which has multiple ranges tested.

This revision is now accepted and ready to land.Nov 20 2017, 9:46 PM
lib/libcam/tests/cam_test.c
91 โ†—(On Diff #35505)

Ok, I'll add one.

This revision was automatically updated to reflect the committed changes.