summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2006-03-18 18:31:08 +0000
committerMatthieu Herrb <matthieu.herrb@laas.fr>2006-03-18 18:31:08 +0000
commit219ef4e86f05e7a473e399c5188efdb7f16f31f1 (patch)
tree1d6cd296d93c99706a6e86ebafda6d5ab7b4bd79
parent950d308b3230e7e89d307fd95abb983e44987665 (diff)
Avoid potential underflow if read() returns -1. Coverity CID 414XORG-7_0_99_901
-rw-r--r--ChangeLog6
-rw-r--r--xconsole.c20
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 <matthieu.herrb@laas.fr>
+
+ * xconsole.c:
+ Avoid potential underflow if read() returns -1.
+ Coverity CID 414
+
2005-12-20 Kevin E. Martin <kem-at-freedesktop-dot-org>
* 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