diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-05-02 16:42:26 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-05-02 16:42:32 +0100 |
commit | 6e37b318510d66fc6ec7e94f350062279b242afb (patch) | |
tree | fd8199966fd4d759613e1b5e8771634c5463e0d8 | |
parent | dadfbfc6a5a5705f3080f14b98941c3fd8c82368 (diff) | |
download | rockbox-6e37b31851.tar.gz rockbox-6e37b31851.zip |
apps: fix use of negative fd in open_plugin.c
Bug reported by UBSan.
Change-Id: I3223a496dfa5df4e3df97fb88a14ea0174d4b428
-rw-r--r-- | apps/open_plugin.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/open_plugin.c b/apps/open_plugin.c index f7f55d58cd..fad528e215 100644 --- a/apps/open_plugin.c +++ b/apps/open_plugin.c @@ -222,6 +222,8 @@ static int op_get_entry(uint32_t hash, int32_t lang_id, logf("OP get_entry hash: %x lang id: %d db: %s", hash, lang_id, dat_file); int fd = open(dat_file, O_RDONLY); + if(fd < 0) + return OPEN_PLUGIN_NOT_FOUND; opret = op_find_entry(fd, entry, hash, lang_id); close(fd); } |