A bounds check of %N format on Windows. Thanks to Joe Bialek, Adam Zabrocki and Microsoft Vulnerability Research.
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c index a41c38d..f8641b7 100644 --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c
@@ -429,8 +429,12 @@ case 'N': #if (NGX_WIN32) *buf++ = CR; -#endif + if (buf < last) { + *buf++ = LF; + } +#else *buf++ = LF; +#endif fmt++; continue;