Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
dvb_tables: fix extended event parsing
Browse files Browse the repository at this point in the history
The ext_desc / ext_item strings are just copied without language handling.
This patch uses standard dvb_get_string_with_len() function. It's safer
and the language conversions are handled correctly.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
  • Loading branch information
perexg committed Mar 20, 2012
1 parent 2ae9425 commit f5ceace
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/dvb/dvb_tables.c
Expand Up @@ -411,9 +411,13 @@ dvb_desc_extended_event(uint8_t *ptr, int len,
if ((desclen - strlen(desc)) > 2)
{
/* get description -> append to desc if space left */
strncat(desc, "\n", 1);
strncat(desc, (char*)(items+1),
items[0] > (desclen - strlen(desc)) ? (desclen - strlen(desc)) : items[0]);
if (desc[0] != '\0')
strncat(desc, "\n", 1);
if((r = dvb_get_string_with_len(desc + strlen(desc),
desclen - strlen(desc),
items, (localptr + count) - items,
dvb_default_charset)) < 0)
return -1;
}

items += 1 + items[0];
Expand All @@ -422,9 +426,13 @@ dvb_desc_extended_event(uint8_t *ptr, int len,
if ((itemlen - strlen(item)) > 2)
{
/* get item -> append to item if space left */
strncat(item, "\n", 1);
strncat(item, (char*)(items+1),
items[0] > (itemlen - strlen(item)) ? (itemlen - strlen(item)) : items[0]);
if (item[0] != '\0')
strncat(item, "\n", 1);
if((r = dvb_get_string_with_len(item + strlen(item),
itemlen - strlen(item),
items, (localptr + count) - items,
dvb_default_charset)) < 0)
return -1;
}

/* go to next item */
Expand Down

0 comments on commit f5ceace

Please sign in to comment.