]> git.99rst.org Git - git.git/commit
gpg-interface: do not use misdesigned strbuf_split*()
authorOlamide Caleb Bello <redacted>
Thu, 23 Oct 2025 11:13:46 +0000 (11:13 +0000)
committerJunio C Hamano <redacted>
Thu, 23 Oct 2025 16:26:12 +0000 (09:26 -0700)
commitbee1bdd5888aafd1a8d51df000170f18b6a299ac
treeffbcb9666b726ded301d0523237e4fed358d25b4
parent81f86aacc4eb74cdb9c2c8082d36d2070c666045
gpg-interface: do not use misdesigned strbuf_split*()

In get_ssh_finger_print(), the output of the `ssh-keygen` command is
put into `fingerprint_stdout` strbuf. The string in `fingerprint_stdout`
is then split into up to 3 strbufs using strbuf_split_max(). However they
are not modified after the split thereby not making use of the strbuf API
as the fingerprint token is merely returned as a char * and not a strbuf.
Hence they do not need to be strbufs.

Simplify the process of retrieving and returning the desired token by
using strchr() to isolate the token and xmemdupz() to return a copy of the
token. This removes the roundabout way of splitting the string into
strbufs just to return the token.

Reported-by: Junio Hamano <redacted>
Helped-by: Christian Couder <redacted>
Helped-by: Kristoffer Haugsbakk <redacted>
Signed-off-by: Olamide Caleb Bello <redacted>
Signed-off-by: Junio C Hamano <redacted>
gpg-interface.c
git clone https://git.99rst.org/PROJECT