]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: reduce visibility of detect_parse_uint_notending
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 27 Oct 2025 19:43:58 +0000 (20:43 +0100)
committerVictor Julien <vjulien@oisf.net>
Wed, 29 Oct 2025 15:33:53 +0000 (15:33 +0000)
It is meant as an internal function

Also document the function

rust/src/detect/uint.rs

index 40e5f6b374fb1af933c77e45b34b97ae1e753a3c..a2ced3059ba0fc1f5fdcfae6e030bc693418cdc3 100644 (file)
@@ -755,7 +755,15 @@ pub fn detect_match_uint<T: DetectIntType>(x: &DetectUintData<T>, val: T) -> boo
     return false;
 }
 
-pub fn detect_parse_uint_notending<T: DetectIntType>(i: &str) -> IResult<&str, DetectUintData<T>> {
+/// This helper function takes a string and returns a DetectUintData<T>
+/// But it does not check if there are more characters to consume.
+/// As such, it may be used by keywords that want a DetectUintData<T>
+/// and other parameters to parse after.
+/// Callers should ensure to use all_consuming on the remainder
+/// Otherwise, invalid ranges such as 1-foo will be parsed as =1
+pub(crate) fn detect_parse_uint_notending<T: DetectIntType>(
+    i: &str,
+) -> IResult<&str, DetectUintData<T>> {
     let (i, _) = opt(is_a(" "))(i)?;
     let (i, uint) = alt((
         detect_parse_uint_bitmask,