diff --git a/dlls/mshtml/main.c b/dlls/mshtml/main.c
index d61c1f49c8d..4aef4757189 100644
--- a/dlls/mshtml/main.c
+++ b/dlls/mshtml/main.c
@@ -114,7 +114,7 @@ void set_statustext(HTMLDocumentObj* doc, INT id, LPCWSTR arg)
DWORD len = lstrlenW(p) + lstrlenW(arg) - 1;
LPWSTR buf = heap_alloc(len * sizeof(WCHAR));
- snprintfW(buf, len - 1, p, arg);
+ snprintfW(buf, len, p, arg);
p = buf;
}