Skip to content

Commit c73eae8

Browse files
committed
fix: use BufferValue
1 parent 67fe19a commit c73eae8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/node_sqlite.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "node.h"
77
#include "node_errors.h"
88
#include "node_mem-inl.h"
9+
#include "path.h"
910
#include "sqlite3.h"
1011
#include "util-inl.h"
1112

@@ -252,7 +253,11 @@ void DatabaseSync::LoadExtension(const FunctionCallbackInfo<Value>& args) {
252253
return;
253254
}
254255

255-
auto path = node::Utf8Value(env->isolate(), args[0].As<String>());
256+
BufferValue path(env->isolate(), args[0]);
257+
CHECK_NOT_NULL(*path);
258+
ToNamespacedPath(env, &path);
259+
THROW_IF_INSUFFICIENT_PERMISSIONS(
260+
env, permission::PermissionScope::kFileSystemRead, path.ToStringView());
256261
int r = sqlite3_load_extension(db->connection_, *path, nullptr, nullptr);
257262
CHECK_ERROR_OR_THROW(env->isolate(), db->connection_, r, SQLITE_OK, void());
258263
}

0 commit comments

Comments
 (0)