1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00

Added NULL checks for cSatipServer parameters.

This commit is contained in:
Rolf Ahrenberg 2015-01-17 00:00:59 +02:00
parent 184ddf2a53
commit b466d6836e
2 changed files with 24 additions and 28 deletions

View File

@ -239,7 +239,7 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
char *r = strtok_r(p, ",", &s); char *r = strtok_r(p, ",", &s);
while (r) { while (r) {
r = skipspace(r); r = skipspace(r);
cString desc = cString::sprintf("%s #%d", descP, n++); cString desc = cString::sprintf("%s #%d", !isempty(descP) ? descP : "MyBrokenHardware", n++);
cSatipServer *tmp = new cSatipServer(addrP, r, desc); cSatipServer *tmp = new cSatipServer(addrP, r, desc);
if (!serversM.Update(tmp)) { if (!serversM.Update(tmp)) {
info("Adding server '%s|%s|%s'", tmp->Address(), tmp->Model(), tmp->Description()); info("Adding server '%s|%s|%s'", tmp->Address(), tmp->Model(), tmp->Description());
@ -247,7 +247,7 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
} }
else else
DELETENULL(tmp); DELETENULL(tmp);
r = strtok_r(NULL, ",\n", &s); r = strtok_r(NULL, ",", &s);
} }
FREE_POINTER(p); FREE_POINTER(p);
} }

View File

@ -15,9 +15,9 @@
// --- cSatipServer ----------------------------------------------------------- // --- cSatipServer -----------------------------------------------------------
cSatipServer::cSatipServer(const char *addressP, const char *modelP, const char *descriptionP) cSatipServer::cSatipServer(const char *addressP, const char *modelP, const char *descriptionP)
: addressM(addressP), : addressM((addressP && *addressP) ? addressP : "0.0.0.0"),
modelM(modelP), modelM((modelP && *modelP) ? modelP : "DVBS-1"),
descriptionM(descriptionP), descriptionM(!isempty(descriptionP) ? descriptionP : "MyBrokenHardware"),
modelTypeM(eSatipModelTypeNone), modelTypeM(eSatipModelTypeNone),
quirkM(eSatipQuirkNone), quirkM(eSatipQuirkNone),
useCountM(0), useCountM(0),
@ -26,29 +26,25 @@ cSatipServer::cSatipServer(const char *addressP, const char *modelP, const char
lastSeenM(0) lastSeenM(0)
{ {
memset(modelCountM, 0, sizeof(modelCountM)); memset(modelCountM, 0, sizeof(modelCountM));
if (isempty(*modelM)) // These devices contain a session id bug:
modelM = "DVBS-1"; // Inverto Airscreen Server IDL 400 ?
if (!isempty(*descriptionM)) { // Elgato EyeTV Netstream 4Sat ?
// These devices contain a session id bug: if (strstr(*descriptionM, "GSSBOX") || // Grundig Sat Systems GSS.box DSI 400
// Inverto Airscreen Server IDL 400 ? strstr(*descriptionM, "DIGIBIT") || // Telestar Digibit R1
// Elgato EyeTV Netstream 4Sat ? strstr(*descriptionM, "Triax SatIP Converter") // Triax TSS 400
if (strstr(*descriptionM, "GSSBOX") || // Grundig Sat Systems GSS.box DSI 400 )
strstr(*descriptionM, "DIGIBIT") || // Telestar Digibit R1 quirkM |= eSatipQuirkSessionId;
strstr(*descriptionM, "Triax SatIP Converter") // Triax TSS 400 // These devices contain a play (add/delpids) parameter bug:
) if (strstr(*descriptionM, "fritzdvbc")) // Fritz!WLAN Repeater DVB-C
quirkM |= eSatipQuirkSessionId; quirkM |= eSatipQuirkPlayPids;
// These devices contain a play (add/delpids) parameter bug: // These devices contain a frontend locking bug:
if (strstr(*descriptionM, "fritzdvbc")) // Fritz!WLAN Repeater DVB-C if (strstr(*descriptionM, "fritzdvbc")) // Fritz!WLAN Repeater DVB-C
quirkM |= eSatipQuirkPlayPids; quirkM |= eSatipQuirkForceLock;
// These devices contain a frontend locking bug: if (quirkM != eSatipQuirkNone)
if (strstr(*descriptionM, "fritzdvbc")) // Fritz!WLAN Repeater DVB-C info("Malfunctioning '%s' server detected! Please, fix the firmware.", *descriptionM);
quirkM |= eSatipQuirkForceLock; // These devices support the X_PMT protocol extension
if (quirkM != eSatipQuirkNone) if (strstr(*descriptionM, "OctopusNet")) // Digital Devices OctopusNet
info("Malfunctioning '%s' server detected! Please, fix the firmware.", *descriptionM); quirkM |= eSatipQuirkUseXCI;
// These devices support the X_PMT protocol extension
if (strstr(*descriptionM, "OctopusNet")) // Digital Devices OctopusNet
quirkM |= eSatipQuirkUseXCI;
}
char *s, *p = strdup(*modelM); char *s, *p = strdup(*modelM);
char *r = strtok_r(p, ",", &s); char *r = strtok_r(p, ",", &s);
while (r) { while (r) {