Module Name:    src
Committed By:   bouyer
Date:           Sun Sep 30 17:52:06 UTC 2012

Modified Files:
        src/lib/libcurses [netbsd-5]: get_wch.c

Log Message:
Pull up following revision(s) (requested by blymn in ticket #1791):
        lib/libcurses/get_wch.c: revision 1.10
* Size argument for memset when clearing cbuf was wrong, cbuf is an array
  of char not int so memset was stomping memory past the end of the array.
  Use sizeof properly to correctly determine the amount of memory to clear.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.8.1 src/lib/libcurses/get_wch.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/get_wch.c
diff -u src/lib/libcurses/get_wch.c:1.6 src/lib/libcurses/get_wch.c:1.6.8.1
--- src/lib/libcurses/get_wch.c:1.6	Mon Apr 14 20:33:59 2008
+++ src/lib/libcurses/get_wch.c	Sun Sep 30 17:52:06 2012
@@ -1,4 +1,4 @@
-/*   $NetBSD: get_wch.c,v 1.6 2008/04/14 20:33:59 jdc Exp $ */
+/*   $NetBSD: get_wch.c,v 1.6.8.1 2012/09/30 17:52:06 bouyer Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: get_wch.c,v 1.6 2008/04/14 20:33:59 jdc Exp $");
+__RCSID("$NetBSD: get_wch.c,v 1.6.8.1 2012/09/30 17:52:06 bouyer Exp $");
 #endif						  /* not lint */
 
 #include <string.h>
@@ -67,7 +67,7 @@ void
 __init_get_wch(SCREEN *screen)
 {
 	wstate = INKEY_NORM;
-	memset( &screen->cbuf, 0, MAX_CBUF_SIZE * sizeof( int ));
+	memset( &screen->cbuf, 0, sizeof(screen->cbuf));
 	screen->cbuf_head = screen->cbuf_tail = screen->cbuf_cur = 0;
 }
 #endif /* HAVE_WCHAR */

Reply via email to