Fix Coverity warnings in neutrinordp

The automated Coverity scan does not currently include neutrinordp

Two problems fixed:-
1) MAX_STATIC_CHANNELS at 31 is bigger than freerdp->sessings->channels
   (16)
2) pamusername in the mod parameters is assumed to be 256 bytes when
   it is written to.
This commit is contained in:
matt335672
2025-01-27 11:39:38 +00:00
parent 201cdc1aea
commit 8196314ad0
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -1790,6 +1790,10 @@ lfreerdp_synchronize(rdpContext *context)
static boolean
lfreerdp_pre_connect(freerdp *instance)
{
#define MAX_FREERDP_CHANNELS \
(sizeof(instance->settings->channels) / \
sizeof(instance->settings->channels[0]))
struct mod *mod;
int index;
int error;
@@ -1797,7 +1801,7 @@ lfreerdp_pre_connect(freerdp *instance)
int target_chan;
int ch_flags;
char ch_name[256];
const char *ch_names[MAX_STATIC_CHANNELS];
const char *ch_names[MAX_FREERDP_CHANNELS];
char *dst_ch_name;
LOG_DEVEL(LOG_LEVEL_INFO, "lfreerdp_pre_connect:");
@@ -1828,7 +1832,7 @@ lfreerdp_pre_connect(freerdp *instance)
LOG(LOG_LEVEL_INFO, "Channel '%s' not passed to module",
ch_name);
}
else if (target_chan < MAX_STATIC_CHANNELS)
else if (target_chan < MAX_FREERDP_CHANNELS)
{
dst_ch_name = instance->settings->channels[target_chan].name;
ch_names[target_chan] = dst_ch_name;
+1 -1
View File
@@ -231,7 +231,7 @@ struct mod
struct bitmap_item bitmap_cache[4][4096];
struct brush_item brush_cache[64];
struct pointer_item pointer_cache[32];
char pamusername[255];
char pamusername[256];
int allow_client_experiencesettings;
int perf_settings_override_mask; /* Performance bits overridden in ini file */