mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
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:
2 files changed
+13
-1
No files matched your search
@@ -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());
|
||||
Reference in new issue
Block a user