summaryrefslogtreecommitdiff
path: root/video.c
diff options
context:
space:
mode:
authormini73 <@>2014-10-11 16:56:24 +0200
committerJohns <johns98@gmx.net>2014-10-11 16:56:24 +0200
commitc2556eb90a83185e32f801163281eb8f30ea1b40 (patch)
tree6a97e81ef369289c7d975d530663d4f2cb36ac74 /video.c
parenta3c0052c4b87b44679d8264c89d085fcda721a2e (diff)
downloadvdr-plugin-softhddevice-c2556eb90a83185e32f801163281eb8f30ea1b40.tar.gz
vdr-plugin-softhddevice-c2556eb90a83185e32f801163281eb8f30ea1b40.tar.bz2
Fix bug: random rubbish at the end of letter.
Diffstat (limited to 'video.c')
-rw-r--r--video.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/video.c b/video.c
index a5b3a5a..2fd63d7 100644
--- a/video.c
+++ b/video.c
@@ -9736,6 +9736,7 @@ static void VideoEvent(void)
const char *keynam;
char buf[64];
char letter[64];
+ int letter_len;
uint32_t values[1];
VideoThreadLock();
@@ -9775,8 +9776,14 @@ static void VideoEvent(void)
break;
case KeyPress:
VideoThreadLock();
- XLookupString(&event.xkey, letter, sizeof(letter), &keysym, NULL);
+ letter_len =
+ XLookupString(&event.xkey, letter, sizeof(letter) - 1, &keysym,
+ NULL);
VideoThreadUnlock();
+ if (letter_len < 0) {
+ letter_len = 0;
+ }
+ letter[letter_len] = '\0';
if (keysym == NoSymbol) {
Warning(_("video/event: No symbol for %d\n"),
event.xkey.keycode);