From 219ef4e86f05e7a473e399c5188efdb7f16f31f1 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sat, 18 Mar 2006 18:31:08 +0000 Subject: Avoid potential underflow if read() returns -1. Coverity CID 414 --- ChangeLog | 6 ++++++ xconsole.c | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71bfbe6..9e3e4ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-18 Matthieu Herrb + + * xconsole.c: + Avoid potential underflow if read() returns -1. + Coverity CID 414 + 2005-12-20 Kevin E. Martin * configure.ac: diff --git a/xconsole.c b/xconsole.c index c79d72c..1e2a41a 100644 --- a/xconsole.c +++ b/xconsole.c @@ -516,17 +516,17 @@ inputReady(XtPointer w, int *source, XtInputId *id) { OpenConsole(); } - - } - Notify (); - buffer[n] = '\0'; - if (app_resources.stripNonprint) - { - stripNonprint (buffer); - n = strlen (buffer); + } else { + Notify(); + buffer[n] = '\0'; + if (app_resources.stripNonprint) + { + stripNonprint (buffer); + n = strlen (buffer); + } + + TextAppend ((Widget) text, buffer, n); } - - TextAppend ((Widget) text, buffer, n); } static Boolean -- cgit v1.2.3