]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Correct WHOX overflow check so it also works for fields other than the last.
authorJilles Tjoelker <redacted>
Sun, 1 Mar 2009 00:58:53 +0000 (01:58 +0100)
committerJilles Tjoelker <redacted>
Sun, 1 Mar 2009 00:58:53 +0000 (01:58 +0100)
Found with llvm static analyzer.

modules/m_who.c

index 63fb2ed35f35ed221c1afb4c85b640c023030211..b8ffc873d99ac14aec01ae5c634dee74048a40e5 100644 (file)
@@ -442,7 +442,7 @@ append_format(char *buf, size_t bufsize, size_t *pos, const char *fmt, ...)
 
        max = *pos >= bufsize ? 0 : bufsize - *pos;
        va_start(ap, fmt);
-       result = rb_vsnprintf(buf + *pos, bufsize - *pos, fmt, ap);
+       result = rb_vsnprintf(buf + *pos, max, fmt, ap);
        va_end(ap);
        *pos += result;
 }