diff mbox

libdvbv5: Fix dvb-format-convert segfault

Message ID alpine.LFD.2.20.1603181255120.22757@fractal.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

Edward Sheldrake March 18, 2016, 12:58 p.m. UTC
Fixes dvb-format-convert crashing when encountering an
unrecognised polarization value.

Signed-off-by: Edward Sheldrake <ejsheldrake@gmail.com>
---
 lib/libdvbv5/dvb-file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 3fda65f..fc2bebc 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -648,8 +648,8 @@  static int fill_entry(struct dvb_entry *entry, char *key, char *value)
 	else if (!strcasecmp(key, "AUDIO_PID"))
 		is_audio = 1;
 	else if (!strcasecmp(key, "POLARIZATION")) {
-		for (j = 0; ARRAY_SIZE(dvb_sat_pol_name); j++)
-			if (!strcasecmp(value, dvb_sat_pol_name[j]))
+		for (j = 0; j < ARRAY_SIZE(dvb_sat_pol_name); j++)
+			if (dvb_sat_pol_name[j] && !strcasecmp(value, dvb_sat_pol_name[j]))
 				break;
 		if (j == ARRAY_SIZE(dvb_sat_pol_name))
 			return -2;