mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Introduce and use strbuf_chomp.
Those chomp operations in wincons.c and uxcons.c looked ugly, and I'm
not totally convinced they couldn't underrun the buffer by 1 byte in
weird circumstances. strbuf_chomp is neater.
(cherry picked from commit 7590d0625b
)
This commit is contained in:
@ -515,10 +515,8 @@ int console_get_userpass_input(prompts_t *p)
|
||||
}
|
||||
|
||||
strbuf_shrink_to(pr->result, prev_result_len + ret);
|
||||
if (pr->result->s[pr->result->len - 1] == '\n') {
|
||||
strbuf_shrink_by(pr->result, 1);
|
||||
if (pr->result->s[pr->result->len - 1] == '\r')
|
||||
strbuf_shrink_by(pr->result, 1);
|
||||
if (strbuf_chomp(pr->result, '\n')) {
|
||||
strbuf_chomp(pr->result, '\r');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user