Skip to content

Commit c214ab4

Browse files
musmstaticfloat
authored andcommitted
Resize credential buffer in winprompt in case of failure (#38828)
(cherry picked from commit 1a58783)
1 parent 858216b commit c214ab4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

base/util.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,13 @@ if Sys.iswindows()
306306
succeeded = ccall((:CredPackAuthenticationBufferW, "credui.dll"), stdcall, Bool,
307307
(UInt32, Cwstring, Cwstring, Ptr{UInt8}, Ptr{UInt32}),
308308
CRED_PACK_GENERIC_CREDENTIALS, default_username, "", credbuf, credbufsize)
309-
@assert succeeded
309+
if !succeeded
310+
credbuf = resize!(credbuf, credbufsize[])
311+
succeeded = ccall((:CredPackAuthenticationBufferW, "credui.dll"), stdcall, Bool,
312+
(UInt32, Cwstring, Cwstring, Ptr{UInt8}, Ptr{UInt32}),
313+
CRED_PACK_GENERIC_CREDENTIALS, default_username, "", credbuf, credbufsize)
314+
@assert succeeded
315+
end
310316

311317
# Step 2: Create the actual dialog
312318
# 2.1: Set up the window

0 commit comments

Comments
 (0)