read_full_config error can't abort maat_new

This commit is contained in:
liuwentan
2023-04-12 15:31:17 +08:00
parent 53cd03995d
commit e8fb0143e9
7 changed files with 216 additions and 76 deletions

View File

@@ -435,8 +435,8 @@ int load_maat_json_file(struct maat *maat_instance, const char *json_filename,
}
if (!maat_instance->is_running) {
strncpy(maat_instance->json_ctx.json_file, json_filename,
sizeof(maat_instance->json_ctx.json_file));
size_t len = MIN(strlen(json_filename), sizeof(maat_instance->json_ctx.json_file));
strncpy(maat_instance->json_ctx.json_file, json_filename, len);
}
ret = stat(json_filename, &fstat_buf);