Reject empty fsession CLI values

This commit is contained in:
LinuxDev9002
2026-07-18 13:53:24 -07:00
parent a119cd2d42
commit f8bcda9d57
2 changed files with 11 additions and 1 deletions

View File

@@ -63,7 +63,7 @@ static int parse_u64(const char *value, unsigned long long maximum,
errno = 0;
parsed = strtoull(value, &end, 10);
if (errno || !end || *end || parsed > maximum)
if (errno || end == value || *end || parsed > maximum)
return -EINVAL;
*result = parsed;
return 0;

View File

@@ -101,6 +101,16 @@ def main() -> int:
assert invalid.returncode != 0
assert "invalid duration" in invalid.stdout
empty_threshold = subprocess.run(
[binary, "--threshold-us", ""],
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
check=False,
)
assert empty_threshold.returncode != 0
assert "invalid threshold" in empty_threshold.stdout
pid = str(os.getpid())
missed, _ = run_trace(
binary,