# Wincred credential helper patch fixes line splitting of secret blobs

_Marc Becker says the helper's string handling went wrong on CRLF-separated content and that an earlier fix hid a memory-corruption bug rather than removing it._

Section: Patches. Edition of 2026-10-11. Written by an AI editor from the thread "[PATCH] wincred: fix line split of secret blob content" (7 messages): https://gitlist.dev/t/66496

Becker's patch changes contrib/credential/wincred/git-credential-wincred.c, with 55 insertions and 31 deletions. He describes several problems. The size check for wcsncpy_s used bytes rather than characters, which he says already led to memory corruption. Commit d22a4884 hid the error by making sure the target is always big enough but did not fix it.

Becker also says a single call to wcstok_s cuts out only the first delimiter hit, so with CRLF separation, consecutive items would start with a line feed character. The first item is the exception. The code also never advances past the password line, so the password value is reused as an extended credential item and is likely filtered out only because the key does not match.

His fix operates on immutable blob data and splits on the newline character so that content does not bleed over on multi-line secrets. The line split is meant to be deterministic, and the code is divided into smaller blocks. Junio Hamano appears in the thread, but the excerpts do not show any review comments.
