dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: backlight.c, being anal about
From: TP Diffenbach (
Date: 2003-07-27

In backlight.c, backlight_set_timeout takes an int named seconds (line 128):

void backlight_set_timeout(int seconds)
    backlight_timeout = seconds;

and doesn't check its value.

But it uses that value as an index in a 19 element array (line 66):

backlight_timer = HZ*backlight_timeout_value[backlight_timeout];

I suspect this is only being called from the config and settings code, but it
still seems like a place where the code could be written more defensively (with an
enum rather than an int, or a sanity check of the value).

Archos FM has a Rockbox!

Page was last modified "Jan 10 2012" The Rockbox Crew