changeset 313:7c96f52e9a3b

memset() history buffer variable unconditionally to avoid derefencing uninitialized memory.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 11 Jun 2011 06:01:23 +0300
parents a0c001672b44
children 77f2093f9310
files nnchat.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Sat Jun 11 06:00:31 2011 +0300
+++ b/nnchat.c	Sat Jun 11 06:01:23 2011 +0300
@@ -1249,6 +1249,7 @@
     cfgitem_t *tmpcfg;
     char *homeDir = NULL;
 
+    memset(histBuf, 0, sizeof(histBuf));
     
     /* Initialize */
     th_init("NNChat", "Newbie Nudes chat client", NN_VERSION,
@@ -1458,7 +1459,6 @@
 
     if (cursesInit) {
         /* Initialize rest of interactive UI code */
-        memset(histBuf, 0, sizeof(histBuf));
         nn_editbuf_clear(editBuf);
 
         /* First update of screen */