diff options
| author | Olamide Caleb Bello <belkid98@gmail.com> | 2025-10-23 11:13:46 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-10-23 09:26:12 -0700 |
| commit | bee1bdd5888aafd1a8d51df000170f18b6a299ac (patch) | |
| tree | ffbcb9666b726ded301d0523237e4fed358d25b4 /t/unit-tests | |
| parent | 81f86aacc4eb74cdb9c2c8082d36d2070c666045 (diff) | |
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 <gitster@pobox.com>
Helped-by: Christian Couder <christian.couder@gmail.com>
Helped-by: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests')
0 files changed, 0 insertions, 0 deletions
