]> git.kaiwu.me - nginx.git/commitdiff
limit string length
authorIgor Sysoev <igor@sysoev.ru>
Thu, 24 Jan 2008 15:18:58 +0000 (15:18 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 24 Jan 2008 15:18:58 +0000 (15:18 +0000)
src/core/ngx_string.c

index 11f1cf28c0ffd74b069ac612a0bbb10a5b26e68c..acd9382dda6366c4492fa08a72193375d21c8335 100644 (file)
@@ -227,7 +227,9 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
                     }
 
                 } else {
-                    buf = ngx_cpymem(buf, p, slen);
+                    len = (buf + slen < last) ? slen : (size_t) (last - buf);
+
+                    buf = ngx_cpymem(buf, p, len);
                 }
 
                 fmt++;