public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Check response for CSI6n more strictly. Date: Wed, 16 Dec 2020 09:39:20 +0000 (GMT) [thread overview] Message-ID: <20201216093920.EDF783844011@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=da8cebcdedb07ea1029009c19f6c2dc23216e4dd commit da8cebcdedb07ea1029009c19f6c2dc23216e4dd Author: Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com> Date: Wed Dec 16 18:10:15 2020 +0900 Cygwin: pty: Check response for CSI6n more strictly. - Previous code to read response for CSI6n allows invalid response such as "CSI Pl; Pc H" other than correct response "CSI Pl; Pc R". With this patch, the response is checked more strictly. Diff: --- winsup/cygwin/fhandler_tty.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 5f38ca8d3..77d9d9b47 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -2682,7 +2682,9 @@ fhandler_pty_slave::term_has_pcon_cap (const WCHAR *env) len -= n; *p = '\0'; char *p1 = strrchr (buf, '\033'); - if (p1 == NULL || sscanf (p1, "\033[%d;%dR", &y1, &x1) != 2) + char c; + if (p1 == NULL || sscanf (p1, "\033[%d;%d%c", &y1, &x1, &c) != 3 + || c != 'R') continue; wait_cnt = 0; break; @@ -2715,7 +2717,9 @@ fhandler_pty_slave::term_has_pcon_cap (const WCHAR *env) len -= n; *p = '\0'; char *p2 = strrchr (buf, '\033'); - if (p2 == NULL || sscanf (p2, "\033[%d;%dR", &y2, &x2) != 2) + char c; + if (p2 == NULL || sscanf (p2, "\033[%d;%d%c", &y2, &x2, &c) != 3 + || c != 'R') continue; break; }
reply other threads:[~2020-12-16 9:39 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201216093920.EDF783844011@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).