fs: validate statfs path

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Efe authored and GitHub committed 2026-01-03 03:01:34 +00:00
1 parent ae5cbdae56
commit 95852d7156
2 files changed
+13 -1

No files matched your search

+1 -1
View File
@@ -1047,7 +1047,7 @@ async function stat(path, options = { bigint: false }) {
async function statfs(path, options = { bigint: false }) {
const result = await PromisePrototypeThen(
binding.statfs(path, options.bigint, kUsePromises),
binding.statfs(getValidatedPath(path), options.bigint, kUsePromises),
undefined,
handleErrorFromBinding,
);
@@ -0,0 +1,12 @@
'use strict';
const common = require('../common');
const fs = require('fs');
const assert = require('assert');
(async () => {
await assert.rejects(
fs.promises.statfs(),
{ code: 'ERR_INVALID_ARG_TYPE' },
);
})().then(common.mustCall());