Patchwork [PULL,2/2] monitor: assert monitor_puts()'s loop invariant

login
register
mail settings
Submitter Luiz Capitulino
Date Jan. 10, 2013, 5:47 p.m.
Message ID <1357840026-32368-3-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/211106/
State New
Headers show

Comments

Luiz Capitulino - Jan. 10, 2013, 5:47 p.m.
From: Markus Armbruster <armbru@redhat.com>

Chiefly to hush up Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/monitor.c b/monitor.c
index 9cf419b..c6eac60 100644
--- a/monitor.c
+++ b/monitor.c
@@ -270,6 +270,7 @@  static void monitor_puts(Monitor *mon, const char *str)
     char c;
 
     for(;;) {
+        assert(mon->outbuf_index < sizeof(mon->outbuf) - 1);
         c = *str++;
         if (c == '\0')
             break;