mcp-ssh-manager 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,7 +48,14 @@ export function shellPath(value) {
48
48
  * @returns {number} A non-negative integer
49
49
  */
50
50
  export function safeInteger(value, fallback) {
51
- const n = Number(value);
51
+ let n;
52
+ try {
53
+ n = Number(value);
54
+ } catch {
55
+ return fallback; // an object that cannot become a number at all (found by the property test)
56
+ }
52
57
  if (!Number.isFinite(n)) return fallback;
53
- return Math.max(0, Math.trunc(n));
58
+ // Capped: above 2^53 a number is no longer exact, and from 1e21 up it prints
59
+ // as "1e+21", which no command reads as a count (found by the property test).
60
+ return Math.min(Number.MAX_SAFE_INTEGER, Math.max(0, Math.trunc(n)));
54
61
  }