[mednaffe] 62/99: Fix potential access beyond array bounds

Stephen Kitt skitt at moszumanska.debian.org
Tue Aug 2 21:00:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

skitt pushed a commit to branch master
in repository mednaffe.

commit e37be490f9243a00546852b2451236a8d6f5e9e8
Author: AmatCoder <amatcoder at gmail.com>
Date:   Sat May 2 15:45:10 2015 +0200

    Fix potential access beyond array bounds
---
 src/input.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/input.c b/src/input.c
index fa9808a..f1a5dfb 100644
--- a/src/input.c
+++ b/src/input.c
@@ -156,10 +156,13 @@ gboolean joy_watch( GIOChannel *channel, GIOCondition cond, guidata *gui)
      break;
   }
   
-  if ((fd==0) || (fd != gui->joy[a].js_fd))
-    return FALSE;
-    
-  read (fd, &e, sizeof(e));
+  if (fd==0) return FALSE;
+  if (a>8) return FALSE;
+  if (fd != gui->joy[a].js_fd) return FALSE;
+  
+  ssize_t s = read (fd, &e, sizeof(e));
+  
+  if (s==-1) return TRUE;
   
   if (gui->inputedited == TRUE)
    return TRUE;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mednaffe.git



More information about the Pkg-games-commits mailing list