Module Name:    src
Committed By:   joerg
Date:           Thu Jul  9 22:08:45 UTC 2009

Modified Files:
        src/lib/libcurses: chgat.c

Log Message:
Ensure that y,x are valid coordinates before using them.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libcurses/chgat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcurses/chgat.c
diff -u src/lib/libcurses/chgat.c:1.2 src/lib/libcurses/chgat.c:1.3
--- src/lib/libcurses/chgat.c:1.2	Tue Jul  7 13:10:02 2009
+++ src/lib/libcurses/chgat.c	Thu Jul  9 22:08:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: chgat.c,v 1.2 2009/07/07 13:10:02 joerg Exp $	*/
+/*	$NetBSD: chgat.c,v 1.3 2009/07/09 22:08:45 joerg Exp $	*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: chgat.c,v 1.2 2009/07/07 13:10:02 joerg Exp $");
+__RCSID("$NetBSD: chgat.c,v 1.3 2009/07/09 22:08:45 joerg Exp $");
 
 #include "curses.h"
 #include "curses_private.h"
@@ -61,6 +61,11 @@
 	__LINE *lp;
 	__LDATA *lc;
 
+	if (x < 0 || y < 0)
+		return (ERR);
+	if (x >= win->maxx || y >= win->maxy)
+		return (ERR);
+
 	attr = (attr & ~__COLOR) | COLOR_PAIR(color);
 
 	if (count < 0 || count > win->maxx - x)

Reply via email to