Commit 56b1cd40 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix for null pointer dereference

When there are no items in the scroll list, the check of select/adjust clicks were using event_item=0 and looking up in a NULL sdata list.
Move the (existing) early exit a bit higher up, since there are no entries in the list the _select_item() calls aren't needed anyway.
Fixes issue reported by John Rickman https://www.riscosopen.org/forum/forums/4/topics/4011

Version 0.41. Tagged as 'Gadgets-0_41'
parent 7b479563
/* (0.40)
/* (0.41)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.40
#define Module_MajorVersion_CMHG 0.41
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 28 Nov 2015
#define Module_Date_CMHG 25 Mar 2016
#define Module_MajorVersion "0.40"
#define Module_Version 40
#define Module_MajorVersion "0.41"
#define Module_Version 41
#define Module_MinorVersion ""
#define Module_Date "28 Nov 2015"
#define Module_Date "25 Mar 2016"
#define Module_ApplicationDate "28-Nov-15"
#define Module_ApplicationDate "25-Mar-16"
#define Module_ComponentName "Gadgets"
#define Module_ComponentPath "castle/RiscOS/Sources/Toolbox/Gadgets"
#define Module_FullVersion "0.40"
#define Module_HelpVersion "0.40 (28 Nov 2015)"
#define Module_LibraryVersionInfo "0:40"
#define Module_FullVersion "0.41"
#define Module_HelpVersion "0.41 (25 Mar 2016)"
#define Module_LibraryVersionInfo "0:41"
......@@ -1456,6 +1456,10 @@ static _kernel_oserror *scrolllist_mclick(const PrivateScrollList *sdata,
event_item = -mouse_y / item_height;
/* SNB: 19980518: changed condition to >= to stop "extra item" events. */
if (event_item >= sdata->no_entries)
return NULL;
if (click->buttons >= 256)
{
if ((click->buttons / 256) & (1<<0))
......@@ -1470,11 +1474,6 @@ static _kernel_oserror *scrolllist_mclick(const PrivateScrollList *sdata,
}
// Send event -
/* SNB: 19980518: changed condition to >= to stop "extra item" events. */
if (event_item >= sdata->no_entries)
return NULL;
event_flags = 0;
if (click->buttons < 16)
......
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