Thread (20 messages) 20 messages, 2 authors, 2025-10-23

Re: [Outreachy PATCH v4 2/2] gpg-interface: do not use misdesigned strbuf_split*() [Part 2]

From: Christian Couder <hidden>
Date: 2025-10-21 07:01:19

On Tue, Oct 21, 2025 at 12:57 AM Olamide Caleb Bello [off-list ref] wrote:

[...]
Reported-by: Junio Hamano <redacted>
Helped-by: Christian Couder [off-list ref]
Helped-by: Junio Hamano [off-list ref]
Helped-by: Krisoffer Haughsbakk
I won't repeat the issues that are the same as in patch 1/2, but
please correct them.

[...]
quoted hunk ↗ jump to hunk
@@ -887,19 +887,21 @@ static char *get_default_ssh_signing_key(void)
                           &key_stderr, 0);

        if (!ret) {
-               keys = strbuf_split_max(&key_stdout, '\n', 2);
-               if (keys[0] && is_literal_ssh_key(keys[0]->buf, &literal_key)) {
+               begin = key_stdout.buf;
+               new_line = strchr(begin, '\n');
+               first_line = xmemdupz(begin, new_line - begin);
What if no \n character is found by strchr()?

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help