From 9b564981ba38e460b4bfedb42b49686b902f65f9 Mon Sep 17 00:00:00 2001 From: winesync Date: Tue, 8 Dec 2020 18:01:20 +0100 Subject: [PATCH] [WINESYNC] wininet: Use _ltow instead of sprintf for port number in InternetCreateUrl. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard wine commit id 9fe900532eb310d114c04d15a8d0b986ec831552 by Jacek Caban --- dll/win32/wininet/internet.c | 13 ++++++------- sdk/tools/winesync/wininet.cfg | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/dll/win32/wininet/internet.c b/dll/win32/wininet/internet.c index e400fb22162..111ce34ba3f 100644 --- a/dll/win32/wininet/internet.c +++ b/dll/win32/wininet/internet.c @@ -4280,9 +4280,10 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents, if (!url_uses_default_port(nScheme, lpUrlComponents->nPort)) { - char szPort[MAX_WORD_DIGITS+1]; + WCHAR port[MAX_WORD_DIGITS + 1]; - *lpdwUrlLength += sprintf(szPort, "%d", lpUrlComponents->nPort); + _ltow(lpUrlComponents->nPort, port, 10); + *lpdwUrlLength += lstrlenW(port); *lpdwUrlLength += strlen(":"); } @@ -4438,10 +4439,8 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, { DWORD dwLen; INTERNET_SCHEME nScheme; - WCHAR *start = lpszUrl; static const WCHAR slashSlashW[] = {'/','/'}; - static const WCHAR fmtW[] = {'%','u',0}; TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength); @@ -4526,9 +4525,9 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, if (!url_uses_default_port(nScheme, lpUrlComponents->nPort)) { - *lpszUrl = ':'; - lpszUrl++; - lpszUrl += swprintf(lpszUrl, *lpdwUrlLength - (lpszUrl - start), fmtW, lpUrlComponents->nPort); + *lpszUrl++ = ':'; + _ltow(lpUrlComponents->nPort, lpszUrl, 10); + lpszUrl += lstrlenW(lpszUrl); } /* add slash between hostname and path if necessary */ diff --git a/sdk/tools/winesync/wininet.cfg b/sdk/tools/winesync/wininet.cfg index 99642310238..a73ecd94515 100644 --- a/sdk/tools/winesync/wininet.cfg +++ b/sdk/tools/winesync/wininet.cfg @@ -5,4 +5,4 @@ files: include/wininet.h: sdk/include/psdk/wininet.h include/winineti.h: sdk/include/psdk/winineti.h tags: - wine: aa384d36429110970aa72acbc5043158de6aff03 + wine: 9fe900532eb310d114c04d15a8d0b986ec831552