gpgme/gpgme-1.23.2-sast_fix2.patch
Michal Hlavinka c21c3b1797 fix static analysis findings (RHEL-44568)
Resolves: RHEL-44568
2024-08-05 22:35:14 +02:00

40 lines
1.3 KiB
Diff

diff -up gpgme-1.23.2/src/engine.c.sast_fix2 gpgme-1.23.2/src/engine.c
--- gpgme-1.23.2/src/engine.c.sast_fix2 2024-08-05 17:31:46.790089148 +0200
+++ gpgme-1.23.2/src/engine.c 2024-08-05 17:34:55.788069948 +0200
@@ -73,7 +73,7 @@ static char *engine_minimal_version;
static const char *
engine_get_file_name (gpgme_protocol_t proto)
{
- if (proto > DIM (engine_ops))
+ if (proto >= DIM (engine_ops))
return NULL;
if (engine_ops[proto] && engine_ops[proto]->get_file_name)
@@ -103,7 +103,7 @@ engine_get_home_dir (gpgme_protocol_t pr
static char *
engine_get_version (gpgme_protocol_t proto, const char *file_name)
{
- if (proto > DIM (engine_ops))
+ if (proto >= DIM (engine_ops))
return NULL;
if (engine_ops[proto] && engine_ops[proto]->get_version)
@@ -118,7 +118,7 @@ engine_get_version (gpgme_protocol_t pro
static const char *
engine_get_req_version (gpgme_protocol_t proto)
{
- if (proto > DIM (engine_ops))
+ if (proto >= DIM (engine_ops))
return NULL;
if (engine_ops[proto] && engine_ops[proto]->get_req_version)
@@ -403,7 +403,7 @@ _gpgme_set_engine_info (gpgme_engine_inf
char *new_version;
/* FIXME: Use some PROTO_MAX definition. */
- if (proto > DIM (engine_ops))
+ if (proto >= DIM (engine_ops))
return gpg_error (GPG_ERR_INV_VALUE);
while (info && info->protocol != proto)