1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Made LIRC command parsing more robust

This commit is contained in:
Klaus Schmidinger 2005-09-02 12:52:37 +02:00
parent c95ee7d367
commit 13b74854b3
3 changed files with 7 additions and 2 deletions

View File

@ -1387,6 +1387,7 @@ Roman Krenick
Ville Skyttä <ville.skytta@iki.fi> Ville Skyttä <ville.skytta@iki.fi>
for reporting several compiler warnings in gcc 4.0 for reporting several compiler warnings in gcc 4.0
for including the optional user defined Make.config from the 'libsi' Makefile for including the optional user defined Make.config from the 'libsi' Makefile
for making LIRC command parsing more robust
Steffen Beyer <cpunk@reactor.de> Steffen Beyer <cpunk@reactor.de>
for fixing setting the colored button help after deleting a recording in case the next for fixing setting the colored button help after deleting a recording in case the next

View File

@ -3762,3 +3762,4 @@ Video Disk Recorder Revision History
- Updated the Swedish OSD texts (thanks to Tomas Prybil). - Updated the Swedish OSD texts (thanks to Tomas Prybil).
- Updated the Slovenian OSD texts (thanks to Matjaz Thaler). - Updated the Slovenian OSD texts (thanks to Matjaz Thaler).
- Updated the Danish OSD texts (thanks to Mogens Elneff). - Updated the Danish OSD texts (thanks to Mogens Elneff).
- Made LIRC command parsing more robust (thanks to Ville Skyttä).

7
lirc.c
View File

@ -6,7 +6,7 @@
* *
* LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16. * LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 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" #include "lirc.h"
@ -76,7 +76,10 @@ void cLircRemote::Action(void)
if (ready && ret > 21) { if (ready && ret > 21) {
int count; int count;
char KeyName[LIRC_KEY_BUF]; 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 (count == 0) {
if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < KEYPRESSDELAY) if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < KEYPRESSDELAY)
continue; // skip keys coming in too fast continue; // skip keys coming in too fast