Module Name:    src
Committed By:   blymn
Date:           Fri Jun 29 10:40:29 UTC 2012

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

Log Message:
* 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.9 -r1.10 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.9 src/lib/libcurses/get_wch.c:1.10
--- src/lib/libcurses/get_wch.c:1.9	Thu Dec 16 17:42:28 2010
+++ src/lib/libcurses/get_wch.c	Fri Jun 29 10:40:29 2012
@@ -1,4 +1,4 @@
-/*   $NetBSD: get_wch.c,v 1.9 2010/12/16 17:42:28 wiz Exp $ */
+/*   $NetBSD: get_wch.c,v 1.10 2012/06/29 10:40:29 blymn 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.9 2010/12/16 17:42:28 wiz Exp $");
+__RCSID("$NetBSD: get_wch.c,v 1.10 2012/06/29 10:40:29 blymn 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