From 0c2e5a19328df891abf89250a0b45bde6d9d8c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E8=B5=AB=E7=84=B6?= Date: Tue, 31 Oct 2023 09:41:22 +0800 Subject: [PATCH] Check repo_id and path is not null --- common/rpc-service.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/rpc-service.c b/common/rpc-service.c index 741964e4..fc4b2f9d 100644 --- a/common/rpc-service.c +++ b/common/rpc-service.c @@ -3182,6 +3182,12 @@ char *seafile_get_file_id_by_path (const char *repo_id, const char *path, GError **error) { + if (!repo_id || !path) { + g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, + "Bad arguments"); + return NULL; + } + char *rpath = format_dir_path (path); char *ret = get_obj_id_by_path (repo_id, rpath, FALSE, error); @@ -3196,6 +3202,12 @@ char *seafile_get_dir_id_by_path (const char *repo_id, const char *path, GError **error) { + if (!repo_id || !path) { + g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, + "Bad arguments"); + return NULL; + } + char *rpath = format_dir_path (path); char *ret = get_obj_id_by_path (repo_id, rpath, TRUE, error);