Commit dcdf4da7 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Fix null pointer deference in List_Read

Detail:
  c/List - The code which initialises yfixed wasn't checking if ListHead.next was valid, leading to a null pointer derefence (and potentially nonsensical yfixed value) the first time the list is filled. Likewise, check whether ListHead.next is valid before attempting to set state.yscroll, in the offchance the list is still empty after we've filled it.
Admin:
  Tested on BB-xM with high processor vectors


Version 0.07. Tagged as 'Bootxxxx-0_07'
parent 7ea8ef36
/* (0.06)
/* (0.07)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.06
#define Module_MajorVersion_CMHG 0.07
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 14 Jan 2012
#define Module_Date_CMHG 09 Jul 2012
#define Module_MajorVersion "0.06"
#define Module_Version 6
#define Module_MajorVersion "0.07"
#define Module_Version 7
#define Module_MinorVersion ""
#define Module_Date "14 Jan 2012"
#define Module_Date "09 Jul 2012"
#define Module_ApplicationDate "14-Jan-12"
#define Module_ApplicationDate "09-Jul-12"
#define Module_ComponentName "Bootxxxx"
#define Module_ComponentPath "castle/RiscOS/Sources/SystemRes/Configure2/PlugIns/Bootxxxx"
#define Module_FullVersion "0.06"
#define Module_HelpVersion "0.06 (14 Jan 2012)"
#define Module_LibraryVersionInfo "0:6"
#define Module_FullVersion "0.07"
#define Module_HelpVersion "0.07 (09 Jul 2012)"
#define Module_LibraryVersionInfo "0:7"
......@@ -176,7 +176,7 @@ _kernel_oserror *List_Read (BOOL rescan)
err = window_get_wimp_handle (0, Pane_Obj, &(state.window_handle));
if (!err) err = wimp_get_window_state (&state);
/* Remember where top of main list was on screen (for rescans) */
if (!err) yfixed = ListHead.next->pos.ymax + state.visible_area.ymax - state.yscroll;
if (!err && ListHead.next) yfixed = ListHead.next->pos.ymax + state.visible_area.ymax - state.yscroll;
/* Free old list */
static_FreeLists (!preserve_main);
......@@ -332,7 +332,7 @@ _kernel_oserror *List_Read (BOOL rescan)
if (!err) err = wimp_get_window_state (&state); /* it may have changed */
if (!err)
{
if (rescan && ListHead.next->next != NULL)
if (rescan && ListHead.next && ListHead.next->next != NULL)
{
state.yscroll = ListHead.next->pos.ymax + state.visible_area.ymax - yfixed;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment