src/irc_line.c
changeset 23 542c73d07d3c
parent 17 5001564ac5fc
child 75 ff6272398d2e
--- a/src/irc_line.c	Sun Mar 01 02:02:48 2009 +0200
+++ b/src/irc_line.c	Sun Mar 08 17:17:37 2009 +0200
@@ -55,7 +55,7 @@
     len = token_len + (flags & TOK_NOSPACE ? 0 : 1) + (flags & TOK_TRAILING ? 1 : 0);
     
     // check overflow
-    if (*offset + len > IRC_LINE_MAX)
+    if (*offset + len + 1 > IRC_LINE_MAX)
         return ERR_LINE_TOO_LONG;
 
     // check invalid tokens
@@ -112,6 +112,9 @@
        }
     }
 
+    // terminate, output_token reserved the space for this
+    buf[off] = '\0';
+
     // done
     return SUCCESS;
 }