From 13b74854b37a3a0f855ee8bf723ee3d9a2c360a5 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 2 Sep 2005 12:52:37 +0200 Subject: Made LIRC command parsing more robust --- lirc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lirc.c') diff --git a/lirc.c b/lirc.c index 2eee9cc0..ac9de010 100644 --- a/lirc.c +++ b/lirc.c @@ -6,7 +6,7 @@ * * LIRC support added by Carsten Koch 2000-06-16. * - * $Id: lirc.c 1.12 2005/08/15 12:28:10 kls Exp $ + * $Id: lirc.c 1.13 2005/09/02 12:51:35 kls Exp $ */ #include "lirc.h" @@ -76,7 +76,10 @@ void cLircRemote::Action(void) if (ready && ret > 21) { int count; char KeyName[LIRC_KEY_BUF]; - sscanf(buf, "%*x %x %29s", &count, KeyName); // '29' in '%29s' is LIRC_KEY_BUF-1! + if (sscanf(buf, "%*x %x %29s", &count, KeyName) != 2) { // '29' in '%29s' is LIRC_KEY_BUF-1! + esyslog("ERROR: unparseable lirc command: %s", buf); + continue; + } if (count == 0) { if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < KEYPRESSDELAY) continue; // skip keys coming in too fast -- cgit v1.2.3