Check the OF_getprop() return value before proceeding. Allocate only as
much space as needed for the mode buffer. Use strcmp, relying on OF giving back NULL terminated strings. Submitted by: marius Approved by: nwhitehorn (mentor)
This commit is contained in:
parent
18709a09ed
commit
18ed1960fc
@ -77,7 +77,7 @@ void
|
||||
OF_init(int (*openfirm)(void *))
|
||||
{
|
||||
phandle_t options;
|
||||
char mode[8];
|
||||
char mode[sizeof("true")];
|
||||
|
||||
openfirmware = openfirm;
|
||||
|
||||
@ -98,8 +98,8 @@ OF_init(int (*openfirm)(void *))
|
||||
* memory later on.
|
||||
*/
|
||||
options = OF_finddevice("/options");
|
||||
OF_getprop(options, "real-mode?", mode, sizeof(mode));
|
||||
if (strncmp(mode, "true", 4) == 0)
|
||||
if (OF_getprop(options, "real-mode?", mode, sizeof(mode)) > 0 &&
|
||||
strcmp(mode, "true") == 0)
|
||||
real_mode = 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user