CAutoModeNotifier: avoid out-of-bounds access

Origin commit data
------------------
Branch: ni/coolstream
Commit: 7c6e91d045
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-05-25 (Sat, 25 May 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2013-05-25 22:04:31 +02:00
parent 9794ff8073
commit 4660043f3c

View File

@@ -556,9 +556,17 @@ bool CAutoModeNotifier::changeNotify(const neutrino_locale_t /*OptionName*/, voi
int i;
int modes[VIDEO_STD_MAX+1];
memset(modes, 0, sizeof(int)*VIDEO_STD_MAX+1);
memset(modes, 0, sizeof(modes));
for(i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) {
if (VIDEOMENU_VIDEOMODE_OPTIONS[i].key < 0) /* not available on this platform */
continue;
if (VIDEOMENU_VIDEOMODE_OPTIONS[i].key >= VIDEO_STD_MAX) {
/* this must not happen */
printf("CAutoModeNotifier::changeNotify VIDEOMODE_OPTIONS[%d].key = %d (>= %d)\n",
i, VIDEOMENU_VIDEOMODE_OPTIONS[i].key, VIDEO_STD_MAX);
continue;
}
modes[VIDEOMENU_VIDEOMODE_OPTIONS[i].key] = g_settings.enabled_video_modes[i];
}
videoDecoder->SetAutoModes(modes);