linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mans Rullgard <mans@mansr.com>
To: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] auxdisplay: charlcd: fix x/y command parsing
Date: Wed,  5 Dec 2018 13:52:47 +0000	[thread overview]
Message-ID: <20181205135247.7964-1-mans@mansr.com> (raw)

Commit b34050fadb86 ("auxdisplay: charlcd: Fix and clean up handling of
x/y commands") fixed some problems by rewriting the parsing code,
but also broke things further by removing the check for a complete
command before attempting to parse it.  As a result, parsing is
terminated at the first x or y character.

This reinstates the check for a final semicolon.  Whereas the original
code use strchr(), this is wasteful seeing as the semicolon is always
at the end of the buffer.  Thus check this character directly instead.

Signed-off-by: Mans Rullgard <mans@mansr.com>
---
 drivers/auxdisplay/charlcd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index 81c22d20d9d9..60e0b772673f 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -538,6 +538,9 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
 	}
 	case 'x':	/* gotoxy : LxXXX[yYYY]; */
 	case 'y':	/* gotoxy : LyYYY[xXXX]; */
+		if (priv->esc_seq.buf[priv->esc_seq.len - 1] != ';')
+			break;
+
 		/* If the command is valid, move to the new address */
 		if (parse_xy(esc, &priv->addr.x, &priv->addr.y))
 			charlcd_gotoxy(lcd);
-- 
2.19.2


             reply	other threads:[~2018-12-05 13:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05 13:52 Mans Rullgard [this message]
2018-12-05 16:47 ` [PATCH] auxdisplay: charlcd: fix x/y command parsing Miguel Ojeda
2018-12-05 17:58   ` Måns Rullgård
2018-12-06 10:06     ` Miguel Ojeda
2018-12-06 12:06       ` Måns Rullgård
2018-12-13 21:03         ` Miguel Ojeda
2018-12-14 12:15           ` Måns Rullgård
2018-12-14 15:50             ` Miguel Ojeda
2018-12-06 23:13       ` Robert Abel
2018-12-06 23:18         ` Miguel Ojeda

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=20181205135247.7964-1-mans@mansr.com \
    --to=mans@mansr.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    /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: link
Be 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 NNTP newsgroup(s).