]> git.ipfire.org Git - thirdparty/git.git/commit
wincred: avoid memory corruption
authorDavid Macek <david.macek.0@gmail.com>
Mon, 17 Nov 2025 20:39:44 +0000 (20:39 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Nov 2025 22:17:42 +0000 (14:17 -0800)
commitd22a488482092da64ad19fda82edde199bed2466
tree975de56c51a354b0fe57dc06f0c88778be66b636
parentf368df439b31b422169975cc3c95f7db6a46eada
wincred: avoid memory corruption

`wcsncpy_s()` wants to write the terminating null character so we need
to allocate one more space for it in the target memory block.

This should fix crashes when trying to read passwords.  When this
happened, the password/token wouldn't print out and Git would therefore
ask for a new password every time.

Signed-off-by: David Macek <david.macek.0@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/credential/wincred/git-credential-wincred.c