On Thu, Jan 17, 2013 at 05:42:20PM -0800, Jason Gerecke wrote:
> If wcmFindProp cannot find the given property, it will return a
> negative error code. At the moment, this is taken as the success
> condition(!?) for the strip_actions case... Aside from being
> wrong, this has the potential to cause some nasty memory corruption.
> 
> Signed-off-by: Jason Gerecke <killert...@gmail.com>
> ---
>  src/wcmXCommand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
> index 6dd6c58..713836c 100644
> --- a/src/wcmXCommand.c
> +++ b/src/wcmXCommand.c
> @@ -356,7 +356,7 @@ static void wcmFindActionHandler(WacomDevicePtr priv, 
> Atom property, Atom **hand
>       }
>  
>       offset = wcmFindProp(property, priv->strip_actions, 
> ARRAY_SIZE(priv->strip_actions));
> -     if (offset < 0)
> +     if (offset >= 0)
>       {
>               *handler = &priv->strip_actions[offset];
>               *action  = &priv->strip_keys[offset];
> -- 
> 1.8.1.1

looking at this, I'd really like a follow-up to return 0 or 1 from
wcmFindActionHandler() and rely on that in the caller rather than checking
handler/action being NULL. Seems like a more understandable API.

Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> for this one though.


Cheers,
   Peter
 

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to