summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2009-09-28 19:56:26 +0200
committerChristian Gmeiner <christian.gmeiner@gmail.com>2009-09-28 19:56:26 +0200
commite80cc173ef63823b7d1d27905eba71495a452b1c (patch)
tree9b8b52f4343913ae694a0e9f09ae1a31aaf4b530
parent4a402480cac86ffa8aab68d54af9cf88fae33401 (diff)
downloadvdr-plugin-dxr3-e80cc173ef63823b7d1d27905eba71495a452b1c.tar.gz
vdr-plugin-dxr3-e80cc173ef63823b7d1d27905eba71495a452b1c.tar.bz2
check num pararmeter of section(..) so that we are on the safe side. Also move a call under an if.
-rw-r--r--spuregion.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/spuregion.c b/spuregion.c
index b2a6526..afa40da 100644
--- a/spuregion.c
+++ b/spuregion.c
@@ -51,7 +51,7 @@ bool cSpuRegion::newSection()
sSection *cSpuRegion::section(uint8_t num)
{
- if (usedSections == MAX_SECTIONS) {
+ if (num >= MAX_SECTIONS) {
return NULL;
}
@@ -60,12 +60,11 @@ sSection *cSpuRegion::section(uint8_t num)
bool cSpuRegion::addIndex(tIndex idx)
{
- sSection *sec = &sections[usedSections];
-
if (containsIndex(idx)) {
return true;
}
+ sSection *sec = &sections[usedSections];
if (sec->usedColors == MAX_COLORS) {
return false;
}