Skip to content

Commit 95852d7

Browse files
authored
fs: validate statfs path
PR-URL: #61230 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: LiviaMedeiros <livia@cirno.name>
1 parent ae5cbda commit 95852d7

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/internal/fs/promises.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ async function stat(path, options = { bigint: false }) {
10471047

10481048
async function statfs(path, options = { bigint: false }) {
10491049
const result = await PromisePrototypeThen(
1050-
binding.statfs(path, options.bigint, kUsePromises),
1050+
binding.statfs(getValidatedPath(path), options.bigint, kUsePromises),
10511051
undefined,
10521052
handleErrorFromBinding,
10531053
);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const fs = require('fs');
5+
const assert = require('assert');
6+
7+
(async () => {
8+
await assert.rejects(
9+
fs.promises.statfs(),
10+
{ code: 'ERR_INVALID_ARG_TYPE' },
11+
);
12+
})().then(common.mustCall());

0 commit comments

Comments
 (0)