Skip to contentSkip to conversation

monitor: assert monitor_puts()'s loop invariant

PATCH Applied Markus Armbruster 2 participants 2 messages Jan 10, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 monitor: assert monitor_puts()'s loop invariant

Chiefly to hush up Coverity.

---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)
monitor.c +1 -0
index 9cf419b..c6eac60 100644
@@ -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;
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 3 lines · On Thu, 10 Jan 2013 14:10:22 +0100 Markus Armbruster <[email protected]> wrote:

Chiefly to hush up Coverity.

Applied to the qmp branch, thanks.

Quoted 16 lines
---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)
monitor.c +1 -0
index 9cf419b..c6eac60 100644
@@ -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;