Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

dvb_tables: fix extended event parsing

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...
commit f5ceace980411cf361f2a2cdcd39a4f749d18237 1 parent 2ae9425
perexg perexg authored

Showing 1 changed file with 14 additions and 6 deletions. Show diff stats Hide diff stats

  1. +14 6 src/dvb/dvb_tables.c
20 src/dvb/dvb_tables.c
@@ -411,9 +411,13 @@ dvb_desc_extended_event(uint8_t *ptr, int len,
411 411 if ((desclen - strlen(desc)) > 2)
412 412 {
413 413 /* get description -> append to desc if space left */
414   - strncat(desc, "\n", 1);
415   - strncat(desc, (char*)(items+1),
416   - items[0] > (desclen - strlen(desc)) ? (desclen - strlen(desc)) : items[0]);
  414 + if (desc[0] != '\0')
  415 + strncat(desc, "\n", 1);
  416 + if((r = dvb_get_string_with_len(desc + strlen(desc),
  417 + desclen - strlen(desc),
  418 + items, (localptr + count) - items,
  419 + dvb_default_charset)) < 0)
  420 + return -1;
417 421 }
418 422
419 423 items += 1 + items[0];
@@ -422,9 +426,13 @@ dvb_desc_extended_event(uint8_t *ptr, int len,
422 426 if ((itemlen - strlen(item)) > 2)
423 427 {
424 428 /* get item -> append to item if space left */
425   - strncat(item, "\n", 1);
426   - strncat(item, (char*)(items+1),
427   - items[0] > (itemlen - strlen(item)) ? (itemlen - strlen(item)) : items[0]);
  429 + if (item[0] != '\0')
  430 + strncat(item, "\n", 1);
  431 + if((r = dvb_get_string_with_len(item + strlen(item),
  432 + itemlen - strlen(item),
  433 + items, (localptr + count) - items,
  434 + dvb_default_charset)) < 0)
  435 + return -1;
428 436 }
429 437
430 438 /* go to next item */

0 comments on commit f5ceace

Please sign in to comment.
Something went wrong with that request. Please try again.